CodeForces 519B A and B and Compilation Errors (超水题)

这道题是超级水的,在博客上看有的人把这道题写的很麻烦。

用 Python 的话是超级的好写,这里就奉上 C/C++ 的AC。

代码如下:

#include <cstdio>
#include <iostream>

using namespace std;

int main(void) 
{
	long long int n, num;
	
	while (scanf("%lld", &n) != EOF) {
		long long int sum1 = 0, sum2 = 0, sum3 = 0;
		
		for (long long int i = 0; i < n; i++) {
			scanf("%lld", &num);
			sum1 += num;
		}
		for (long long int i = 0; i < n-1; i++) {
			scanf("%lld", &num);
			sum2 += num;
		}  
		for (long long int i = 0; i < n-2; i++) {
			scanf("%lld", &num);
			sum3 += num; 
		}
		
		printf("%lld\n", sum1 - sum2);
		printf("%lld\n", sum2 - sum3);
	}
	
	return 0;
} 

 

posted @ 2018-07-21 16:06  laugh12321  阅读(16)  评论(0编辑  收藏  举报