本地测试能通过,在平台上测试全部WA,求解!
查看原帖
本地测试能通过,在平台上测试全部WA,求解!
662170
luoguCoder233楼主2022/2/12 16:55

参考了题解的写法。

#include <iostream>

using namespace std;
int main(int argc, char** argv) {
	long long a;
	int n = 0;
	long long ans;
	while (cin >> a) {
		n++;
		ans = ans + a;
		if (getchar() == '\n') {
			break;
		} else {
			continue;
		}
	}
	for (int i = 1;i < n;i ++) {
		ans = ans * 2;
	}
	printf("%d",ans);
	return 0;
}

在本地IDE上测试能够通过,但是将代码上传到平台运行就全部WA。

2022/2/12 16:55
加载中...