You are viewing a single comment's thread. Return to all comments →
Works fine in c++. Passes all tests.
int n; int l; int count = 0; cin >> n >> l; vector<int> a(n); for(int i = 0;i < n;i++){ cin >> a[i]; } for(int i = 0;i < n;i++) { for(int k = i+1; k < n;k++) { if((a[i] + a[k]) % l == 0 && i < k) count++; } } cout << count;
Seems like cookies are disabled on this browser, please enable them to open this website
Divisible Sum Pairs
You are viewing a single comment's thread. Return to all comments →
Works fine in c++. Passes all tests.