done 3 sorting problems
This commit is contained in:
23
CSES - CSES Problem Set/Introducotry_Problems/Coin_Piles.cpp
Normal file
23
CSES - CSES Problem Set/Introducotry_Problems/Coin_Piles.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
// Coin Piles
|
||||
|
||||
#include<bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
using ll = long long;
|
||||
|
||||
int main() {
|
||||
int t; cin >> t;
|
||||
for (int T{}; T < t; T++) {
|
||||
ll a, b; cin >> a >> b;
|
||||
if (a < b) swap(a, b);
|
||||
if ((a + b) % 3 != 0) {
|
||||
cout << "NO" << endl;
|
||||
continue;
|
||||
} else if (a > 2*b) {
|
||||
cout << "NO" << endl;
|
||||
continue;
|
||||
}
|
||||
cout << "YES" << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user