QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#581329#9375. TouristnuoWA 0ms3948kbC++20501b2024-09-22 12:04:222024-09-22 12:04:22

Judging History

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

  • [2024-09-22 12:04:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3948kb
  • [2024-09-22 12:04:22]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define int long long

int n, c, tot = 1500, ans = -1;

inline int read() {
	int x = 0, f = 1; char c = getchar();
	while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); }
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * f;
}

signed main() {
	n = read();
	for (int i = 1; i <= n; i++) {
		c = read(), tot += c;
		if (ans != -1 && tot >= 4000) ans = i;
	}
	printf("%d\n", ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3948kb

input:

5
1000 1000 1000 -5000 1000

output:

-1

result:

wrong answer 1st lines differ - expected: '3', found: '-1'