-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPTIT017F.cpp
More file actions
40 lines (36 loc) · 823 Bytes
/
PTIT017F.cpp
File metadata and controls
40 lines (36 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<bits/stdc++.h>
using namespace std;
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Ford(i, a, b) for(int i = a; i >= b; i--)
#define ll long long
#define here cout<<"i am here"<<endl;
const long long base= 1e9 + 7;
const int maxn = 1000000;
int test1(string s){
int t = (s[s.length() - 1] - 48) + (s[s.length() - 2] - 48) * 10;
if(t % 4 != 0) return 0;
return 1;
}
int test2(string s){
int t = 0;
For(i, 0, s.length() - 1){
t = t + (s[i] - 48);
}
if(t % 9 == 0) return 1;
return 0;
}
int main(void){
ios::sync_with_stdio(false);
string s;
int t;
cin>>t;
while(t--){
cin>>s;
if(test1(s) == 0) cout<<"NO"<<endl;
else{
if(test2(s) == 0) cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
}
return 0;
}