QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#686196#9531. Weird Ceiling369Pai#WA 1ms3588kbC++23609b2024-10-29 08:14:082024-10-29 08:14:09

Judging History

你现在查看的是最新测评结果

  • [2024-10-29 08:14:09]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3588kb
  • [2024-10-29 08:14:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
inline void solve(){
    int n;cin>>n;
    int rs=n,nn=n,ans=0,la=0;
    vector<int>vc;
    for (int i=1;i*i<=n;++i){
        if (n%i==0) vc.push_back(n/i),rs=n/i;
        ans+=rs,la=i+1;
    }
    sort(vc.begin(),vc.end());
    vc.push_back(n+1);
    for (auto i:vc){
        if (i<=la) continue;
        //[la,i-1]
        ans+=rs*(i-la),rs=n/i,la=i;
    }
    cout<<ans<<'\n';
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int t;cin>>t;
    while (t--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3588kb

input:

3
5
451
114514

output:

21
10251
7075858

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3580kb

input:

1000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101...

output:

1
4
7
9
21
19
43
25
37
36
111
43
157
64
71
65
273
73
343
91
113
144
507
101
201
196
163
134
813
141
931
161
221
324
295
169
1333
400
287
205
1641
225
1807
254
277
576
2163
241
589
301
443
326
2757
298
507
323
533
900
3423
315
3661
1024
439
385
625
386
4423
494
737
437
4971
397
5257
1444
551
590
969
...

result:

wrong answer 2nd lines differ - expected: '3', found: '4'