QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#279218 | #1842. Math | rageOfThunder# | WA | 5ms | 7748kb | C++14 | 1.0kb | 2023-12-08 14:17:10 | 2023-12-08 14:17:10 |
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 = (i + j) / 2;
int b = i * j;
ans += s[a] * s[b];
}
}
cout << ans;
return 0;
}
/* why?
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 5ms
memory: 5764kb
input:
5 1 2 3 4 5
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 3ms
memory: 7748kb
input:
1 1
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: -100
Wrong Answer
time: 3ms
memory: 5708kb
input:
5 6 4 7 3 5
output:
2
result:
wrong answer 1st numbers differ - expected: '1', found: '2'