QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#723846 | #9531. Weird Ceiling | Lbl | WA | 58ms | 3852kb | C++14 | 480b | 2024-11-08 01:25:03 | 2024-11-08 01:25:03 |
Judging History
answer
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
int a[100005];
int main(){
int t;
scanf("%d",&t);
while(t--){
int n;
scanf("%d",&n);
int s=0;
for(int i=1;i<=sqrt(n);i++){
if(n%i==0){
a[s]=i;
s++;
a[s]=n/i;
s++;
}
}
sort(a,a+s);
int sum=0;
for(int i=0;i<s-1;i++){
sum+=(a[i+1]-a[i])*(n/a[i]);
}
sum+=1;
printf("%d ",sum);
printf("\n");
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3852kb
input:
3 5 451 114514
output:
21 10251 7075858
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3852kb
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 3 7 9 21 16 43 25 37 36 111 41 157 64 71 65 273 73 343 86 113 144 507 101 201 196 163 134 813 137 931 161 221 324 295 169 1333 400 287 205 1641 218 1807 254 277 576 2163 241 589 301 443 326 2757 298 507 317 533 900 3423 315 3661 1024 43...
result:
ok 1000 lines
Test #3:
score: -100
Wrong Answer
time: 58ms
memory: 3804kb
input:
1000 999999001 999999002 999999003 999999004 999999005 999999006 999999007 999999008 999999009 999999010 999999011 999999012 999999013 999999014 999999015 999999016 999999017 999999018 999999019 999999020 999999021 999999022 999999023 999999024 999999025 999999026 999999027 999999028 999999029 99999...
output:
969140313 -1726410486 459629095 149860848 1030622429 -1909422146 -1330275445 -2138346165 -68243631 -1259990938 -1421487389 -1665868344 -762561667 -1355522616 1750085139 -1031033803 -1390629783 956252470 -4050461 -2063707598 -1308723339 -421364606 -1473587973 -1071829669 52842...
result:
wrong answer 1st lines differ - expected: '999998001000999001', found: '969140313 '