Source Code

#include <iostream>
using namespace std;
int main()
{
	int n,sum=0;
	cin >> n;
	int a[4];
	for (int i = 0;i <=n/2-1;i++) {
		cin >> a[0] >> a[1];
		sum = sum + a[0];
	}

	for (int i = n / 2;i < n;i++) {
		cin >> a[0] >> a[1];
		sum = sum + a[1];
	}
	cout << sum;
}

Copy
Two Teams anasaburaya
GNU G++17
3 ms
668 KB
Wrong Answer