QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#279220 | #1842. Math | rageOfThunder# | AC ✓ | 31ms | 11468kb | C++14 | 1.0kb | 2023-12-08 14:18:06 | 2023-12-08 14:18:07 |
Judging History
answer
// MagicDark
#include <bits/stdc++.h>
#define debug cerr << "[" << __LINE__ << "] "
#define SZ(x) (int) x.size() - 1
#define all(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define DF(i, x, y) for (int i = (x); i >= (y); i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> inline void chkmax(T& x, T y) {x = max(x, y);}
template <typename T> inline void chkmin(T& x, T y) {x = min(x, y);}
template <typename T> inline void read(T &x) {
x = 0; int f = 1; char c = getchar();
for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
x *= f;
}
const int N = 1e6 + 10;
int n, a[N], s[N];
ll ans;
signed main() {
read(n);
F(i, 1, n) {
read(a[i]);
s[a[i]] = 1;
}
F(i, 1, 1e3) {
for (int j = i + 2; i * j <= 1e6; j += 2) {
int a = (j - i) / 2;
int b = i * j;
ans += s[a] * s[b];
}
}
cout << ans;
return 0;
}
/* why?
*/
詳細信息
Test #1:
score: 100
Accepted
time: 7ms
memory: 5684kb
input:
5 1 2 3 4 5
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 6ms
memory: 5696kb
input:
1 1
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 6ms
memory: 5740kb
input:
5 6 4 7 3 5
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 6ms
memory: 5560kb
input:
50 89 2 3 86 81 59 29 26 28 8 48 5 6 95 54 91 17 83 4 36 15 43 92 70 30 37 23 96 39 80 9 90 49 82 33 71 61 38 99 50 65 47 78 45 68 7 25 42 13 57
output:
29
result:
ok 1 number(s): "29"
Test #5:
score: 0
Accepted
time: 7ms
memory: 5688kb
input:
1000 662 811 263 46 591 511 230 223 628 603 716 880 187 575 701 184 505 754 130 154 367 91 704 945 171 588 19 486 34 513 622 849 629 437 776 290 743 470 587 681 723 271 879 642 77 281 71 655 365 942 809 94 266 148 146 305 198 311 788 69 343 277 887 557 169 41 784 791 451 812 932 663 594 576 487 946 ...
output:
1750
result:
ok 1 number(s): "1750"
Test #6:
score: 0
Accepted
time: 7ms
memory: 5720kb
input:
10000 2246 4941 6031 8713 4705 3744 9374 9432 2502 7080 8851 5408 4724 8905 7565 1699 6660 8959 7798 2287 4610 8806 8128 451 1355 2111 8775 4903 7517 8983 8144 2578 9565 7332 3213 4943 6520 616 2559 5573 6391 7148 5121 8395 5618 8733 6132 3717 8549 9651 1291 9462 5941 2342 9625 398 3916 8586 4290 26...
output:
23368
result:
ok 1 number(s): "23368"
Test #7:
score: 0
Accepted
time: 9ms
memory: 9840kb
input:
100000 94437 49936 62522 1166 33452 90618 91436 81173 99242 37280 46125 44869 52811 45694 11550 29857 48941 56538 35057 40907 79925 70785 29658 19044 32804 11428 4127 92197 12680 61636 27200 56790 83389 80340 54411 15308 38952 78085 81397 37554 44186 33581 35662 73331 84991 32044 69012 82289 63495 6...
output:
291528
result:
ok 1 number(s): "291528"
Test #8:
score: 0
Accepted
time: 31ms
memory: 11460kb
input:
1000000 287979 230793 805881 397585 695359 701731 296206 140797 257828 646397 649020 775370 622178 482759 161855 499413 690372 463229 541524 906954 116709 106321 17736 555558 848745 804067 532778 605445 239082 752084 465207 248311 821443 697678 323802 224937 607056 905999 886110 635290 199168 451068...
output:
3492026
result:
ok 1 number(s): "3492026"
Test #9:
score: 0
Accepted
time: 8ms
memory: 8528kb
input:
1000 565029 359959 442072 749472 436627 555485 999899 922415 688282 1837 954923 117969 220561 401583 15736 11175 958620 494991 571014 578509 112950 719398 584928 609019 303702 314720 102291 123929 820634 58238 378539 87383 808107 690638 311089 86718 217615 410496 917686 56594 212682 997033 576713 36...
output:
4
result:
ok 1 number(s): "4"
Test #10:
score: 0
Accepted
time: 4ms
memory: 8696kb
input:
2000 934018 123504 948037 703617 111073 15546 15911 163976 468543 193910 726931 600453 733138 621635 783758 665702 245047 516540 973366 926404 185794 111170 240828 444820 241580 107050 107147 983125 983719 509772 744587 126168 497533 373596 725070 711935 110270 610693 852007 75812 415887 708945 4232...
output:
12
result:
ok 1 number(s): "12"
Test #11:
score: 0
Accepted
time: 8ms
memory: 8384kb
input:
5000 404514 156022 778654 104905 606286 153975 486040 552761 586695 488891 641333 481377 810874 486969 133738 774191 375113 853489 670894 302425 218622 559664 671453 845525 438566 841765 971373 185037 918208 681021 194600 257469 17258 263521 727182 298432 395201 136887 969041 654228 361441 627046 36...
output:
97
result:
ok 1 number(s): "97"
Test #12:
score: 0
Accepted
time: 27ms
memory: 11468kb
input:
999999 637199 962035 549540 306066 683256 982146 419109 444883 639652 682952 983960 112908 393066 739390 197927 265419 840349 863627 926843 969942 162339 70437 969985 352863 386976 103689 277001 339381 14016 688162 34317 386334 256660 305667 31010 674250 479909 432254 575034 378146 883525 914638 640...
output:
3492021
result:
ok 1 number(s): "3492021"
Test #13:
score: 0
Accepted
time: 15ms
memory: 10312kb
input:
500000 491404 372034 355751 236424 508721 594212 367998 857923 506665 274105 836508 706451 498983 63561 494579 661756 611470 898147 169460 873252 767279 299209 484156 951699 906903 455183 449838 666406 534596 812910 267104 446133 80361 558416 309233 990113 687484 401536 321061 44359 565110 116214 53...
output:
876495
result:
ok 1 number(s): "876495"
Test #14:
score: 0
Accepted
time: 20ms
memory: 10800kb
input:
700000 542043 824656 275019 725125 663633 76446 345569 722725 954407 523509 522864 810560 836717 585914 950832 423067 766556 542007 290389 949920 563105 792385 419462 719140 637288 987066 647103 422434 270323 698969 917723 134229 509697 26949 135145 293898 970665 87357 794642 784148 90355 759702 637...
output:
1715853
result:
ok 1 number(s): "1715853"
Test #15:
score: 0
Accepted
time: 19ms
memory: 10716kb
input:
800000 524345 430102 839374 837031 518646 137170 228764 779992 470062 883938 467978 602502 451096 51337 850637 266347 336074 197215 25085 732336 744893 529854 16702 607016 603093 789011 343254 814771 440652 351758 285877 976780 882697 954083 444762 162736 601098 143001 174386 895968 256584 63417 834...
output:
2242148
result:
ok 1 number(s): "2242148"
Test #16:
score: 0
Accepted
time: 29ms
memory: 11372kb
input:
900000 953834 992167 665073 283724 469347 930979 391834 432998 349663 183445 724052 954268 936923 380557 337472 200659 445465 51690 449268 892364 658706 640141 302696 512515 265145 924638 323657 390608 164941 923280 624434 351764 97956 710698 245590 438460 691426 105988 32249 556390 605876 262033 24...
output:
2824245
result:
ok 1 number(s): "2824245"