QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#279218#1842. MathrageOfThunder#WA 5ms7748kbC++141.0kb2023-12-08 14:17:102023-12-08 14:17:10

Judging History

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

  • [2023-12-08 14:17:10]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:7748kb
  • [2023-12-08 14:17:10]
  • 提交

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?
*/

详细

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'