Official

A - Task Failed Successfully Editorial by en_translator


For beginners

It is sufficient to count the number of indices \(i\) with \(A_i < B_i\). This can be done by using a for statement to check if \(A_i < B_i\) for each \(i\).

Sample code

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

int main() {
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if (a < b) ans++;
	}
	cout << ans << '\n';
}

posted:
last update: