L

mail@pastecode.io avatar
unknown
c_cpp
a month ago
470 B
9
Indexable
Never
#include <bits/stdc++.h>

#define ll long long

using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        int sb = n % 10 + n / 10 % 10 + n / 100 % 10;
        n /= 1000;
        int sa = n % 10 + n / 10 % 10 + n / 100 % 10;
        if (sa == sb) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;    
}

 





Leave a Comment