QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#682985 | #9531. Weird Ceiling | abbcc_1# | AC ✓ | 109ms | 3836kb | C++20 | 988b | 2024-10-27 18:17:45 | 2024-10-27 18:17:46 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int kase;
cin >> kase;
while (kase--) {
int n;
cin >> n;
vector<int> factors;
for (int i = 1; i <= n / i; i += 1) {
if (n % i == 0) {
factors.push_back(i);
if (i != n / i) {
factors.push_back(n / i);
}
}
}
if (n != 1) {
factors.push_back(n);
}
sort(factors.begin(), factors.end());
cerr << '\n';
int lst = 0;
i64 ans = 0;
for (int i = 0; i < factors.size(); i += 1) {
int lim = (i + 1 < factors.size() ? factors[i + 1] : n + 1);
ans += 1LL * (lim - factors[i]) * n / factors[i];
lst = lim + 1;
}
cout << ans << '\n';
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3836kb
input:
3 5 451 114514
output:
21 10251 7075858
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3648kb
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 439 385 625 386 4423 494 737 437 4971 394 5257 1444 551 590 969 ...
result:
ok 1000 lines
Test #3:
score: 0
Accepted
time: 109ms
memory: 3600kb
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:
999998001000999001 4675492974858 22093771399719 1039531946480 546491469021 75399989182 37324430219 225494920523 373593911121 479776346214 428075242211 122888183240 72251882365 33004215752 388297141779 54803541045 999998033000967273 1117647749430 2997883122147 28001063474 320813823861 206612366114726...
result:
ok 1000 lines
Test #4:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
1000 1426 8761 6399 8757 5169 7007 7204 6760 3255 8576 3090 1856 6850 5184 2915 5058 4237 4014 1867 3184 2176 4504 6628 8473 3126 7829 4842 2647 5654 9945 5344 2103 6747 3124 1506 6037 8820 2147 9017 3237 8852 3262 8746 4651 9755 6560 4143 7356 5491 6267 2956 5675 3588 5857 8003 4269 3016 8164 6913 ...
output:
34481 76746361 101599 132329 2984237 142731 3265214 76077 39343 111525 35536 19757 94120 53089 52687 114368 198025 77828 3483823 61890 23713 339490 2765534 654025 283946 61285413 106256 7003963 133898 130281 75986 497711 122139 37844 69026 36439333 93043 87915 1269493 51129 4923926 80386 19131876 21...
result:
ok 1000 lines
Test #5:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
1000 96118 54869 50981 50147 91229 25850 96698 60642 84478 82418 66471 19974 29360 84515 89159 91879 15248 88581 22105 55807 94766 47749 56366 45854 78286 48453 78957 13623 66217 31578 79056 11585 56041 32429 17652 12870 35072 86731 88829 37767 39474 62357 39663 47414 96134 12753 62358 71610 61177 4...
output:
2304331 3010552293 53602881 2514671463 8322639213 373672 48480234 1867550 1784217600 1435037 491132063 11162138 454714 286303015 2957807 25703647 1014946 872109473 19699977 3114365443 2356580 14589157 794337856 4728638 10162126 1515069 1650457 297795 11135973 497770 1049881 292605 3140537641 1051607...
result:
ok 1000 lines
Test #6:
score: 0
Accepted
time: 6ms
memory: 3556kb
input:
1000 511055 954624 323224 436172 101462 148836 436478 592916 344876 280490 695050 422877 437842 854283 161072 923681 833452 995807 463367 478939 779845 311429 967338 205899 493864 398751 601817 866550 553448 183443 887925 599044 978201 552171 561895 859904 929524 729462 136217 683708 949783 507333 8...
output:
21083991 15367425 17288812 8490789 10216806 3270492 975497154 21973615190 6866746 19269664 200883352 9585213 70122662 100155511 102471994 46971481 50512556 311428839 570968779 391706527 23341213 18818905 19572693 4711106387 82854506 41504779 1271887129 14704901 103366298 8673199 152296897 35618964 2...
result:
ok 1000 lines
Test #7:
score: 0
Accepted
time: 11ms
memory: 3492kb
input:
1000 1804536 4211517 9800689 2588266 2822907 2224004 1124395 3723675 9549295 4633411 7897396 8618522 7283975 5872136 6231486 7714888 6991641 8534951 3392355 3815116 8794462 2247351 8020190 7317901 4597237 9810579 6298128 9742586 6491680 4380635 5177276 4955778 9772677 7555632 7185866 1635740 4186286...
output:
32381021 510710481 1149020421 2299688945 120557115 73058506 56457359 90096179 372486107 21468492861511 201545946 153572268266 84999326507 538810316970 135962872 197339289 2205520009 76305215151 203422271 868759184 17483594761 217570279 643282597502 6128235181 21134583436933 486148703 115320743 48435...
result:
ok 1000 lines
Test #8:
score: 0
Accepted
time: 21ms
memory: 3628kb
input:
1000 55465305 57098346 67831452 23824693 27523159 93304012 36627397 23023650 69831611 63929921 33024432 10885102 13588352 95661834 66365676 97190714 86076773 21453770 32264585 24063566 91881325 15845386 84185885 32822035 20536544 87894581 10991552 65603223 14485832 20112669 42652175 83388813 3890302...
output:
1233522469 30231587353 3485251508 200993174065 61256171487 544102695868046 1341566174368213 557396664 7256897799 33778361768221 648207543 7401958318 308423669 254200007209658 3360589556 61975730378 756052267777 510366691 41640363660985 1261557526 3244098109 62769080217636 5786851143705 1258948719 45...
result:
ok 1000 lines
Test #9:
score: 0
Accepted
time: 82ms
memory: 3560kb
input:
1000 915367597 170378636 313770228 902526612 145496151 799225282 489090313 639368427 246375473 965529510 818379863 170086887 211624645 105858477 871824152 641165798 917699672 840652762 179213821 772528742 876606466 644924443 694785183 462164454 633265058 458266866 379020271 665531243 266287336 36576...
output:
871956022960393 7291034186 683694527886654 32386492870 14238918027 2623954560326 296562492633 56988743615 60700873449598257 8574022008528 13668286556543775 4666778451 10045018693 56385310781 11876212984285122 12421378985324 13158952838325042 176674267405209924 33431586765721 38406969428 116532883578...
result:
ok 1000 lines
Test #10:
score: 0
Accepted
time: 71ms
memory: 3592kb
input:
1000 585368002 306372175 416009662 257921061 296636294 870174287 978777851 350263974 606394638 185068088 403887189 407868682 804385858 76886268 259240128 25474974 624426864 479700338 181087332 695036802 747196218 906596932 309327980 257146299 206966230 802007505 987169016 135879955 49370780 63200667...
output:
1610711004706 49023158527 370147227518 1479769413469 59376015616 74401504037683 958006080629400351 10397833137 134489000569 83188941708 18337125509 246095742345598 208410552920 41052506570574 41481313786 871973361 595397901886 20479528405 4500211661 24518043503 128623382928 142311967870164 104523427...
result:
ok 1000 lines
Extra Test:
score: 0
Extra Test Passed