View Code of Problem 6

int main()
{
	int T,flag;
	std::cin >> T;
	int num[101];
	while (T--) {
		int n;
		flag = 0;
		std::cin >> n;
		for (int i = 0; i < n; i++) {
			int l, r;
			std::cin >> l >> r;
			num[i] = r - l;
		}
		for (int j = 0; j < n; j++) {
			if (num[0] != num[j]) {
				std::cout << "NO";
				flag = 1;
			}
		}
			if (flag == 0) {
			std::cout << "YES";
			}
			if (T != 0) {
			  std::cout << "\n";
			}
	}
	return 0;
}
/*
Main.cc: In function 'int main()':
Main.cc:4:2: error: 'cin' is not a member of 'std'
  std::cin >> T;
  ^
Main.cc:9:3: error: 'cin' is not a member of 'std'
   std::cin >> n;
   ^
Main.cc:12:4: error: 'cin' is not a member of 'std'
    std::cin >> l >> r;
    ^
Main.cc:17:5: error: 'cout' is not a member of 'std'
     std::cout << "NO";
     ^
Main.cc:22:4: error: 'cout' is not a member of 'std'
    std::cout << "YES";
    ^
Main.cc:25:6: error: 'cout' is not a member of 'std'
      std::cout << "\n";
      ^
*/

Double click to view unformatted code.


Back to problem 6