- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTemplate.cpp
More file actions
Latest commit
153 lines (137 loc) · 7.29 KB
/
Copy pathTemplate.cpp
File metadata and controls
153 lines (137 loc) · 7.29 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/** <------------------------------------------------>
| ___ |
| ^ ^ |
| / _/\ \ *___* Allah is Almighty |
| \/*.*\/ / * Md. Sakib Uddin. |
| ( _ ) / / RMSTU |
| _>---<__/ / hi.sakib75@gmail.com|
| / sakib / |
| / \/ / |
| \ : : |
| \:______: |
| : L : |
| :__ :__: |
| : :: : |
| :_::_: |
| _:_::_:_ |
| <___::___> |
<------------------------------------------------>**/
#include<bits/stdc++.h>
usingnamespacestd;
#defineboostios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#definelllonglong
#defineullunsignedlonglong
#defineldlongdouble
#definenum_of_ones(n) __builtin_popcount(n)
#defineparity(n) __builtin_parity(n) // odd num of 1's or even num of 1's
#defineleading_zero(n) __builtin_clz(n)
#definetraling_zero(n) __builtin_ctz(n)
#definemin3(a,b,c) min(a,min(b,c))
#definemin4(a,b,c,d) min(d,min3(a,b,c))
#definemax3(a,b,c) max(a,max(b,c))
#definemax4(a,b,c,d) max(d,max3(a,b,c))
#definegcd(a,b) __gcd(a,b)
#definelcm(a,b) (a/__gcd(a,b))*b
#definevi vector<int>
#definevll vector<ll>
#definevc vector<char>
#definevs vector<string>
#defineall(x) x.begin(),x.end()
#definereall(x) x.rbegin(),x.rend()
#defineeb emplace_back
#definepb push_back
#definepopb pop_backh
#definepf push_front
#definepopf pop_front
#definemk make_pair
#defineF first
#defineS second
#definefori(i,b,e) for(int (i)=(b); (i) <= (e); (i)++)
#definefor0(i,n) for(int (i)=0; (i) < (n); (i)++)
#defineforrv(i,b,e) for(int i=b;i>=e;i--)
#definesp(a) fixed<<setprecision(a)
#defineendl'\n'
#defineyes cout << "YES" << '\n'
#defineno cout << "NO" << '\n'
#definecoutl(x) cout << x << '\n'
#definecout(x) cout << x
#definenl cout << '\n'
#defineprintv(v) for(auto it:v) cout << it << ""
#defineCASE(t) printf("Case %lld: ",++t)
#definepi3.141592653589793238//2*acos(0)
#defineinf0x3f3f3f3f
#defineE2.71828182845904523536
#definegamma0.5772156649
#defineConsummationintmain(){int tt; cin >> tt;while(tt--){SakiBee();}return0;}
#defineS_Consummationintmain(){SakiBee();return0;}
#defineTc_Consummationintmain(){int tt,t=0;cin >> tt;while(tt--){cout << "Case " << ++t << ": "; SakiBee();}return0;}
/**_____________________________________DEBUG____________________________________________________**/
template<typename T>voidshowSTL(T H);template<typename T,typename V>voidshowSTL(pair<T,V> H);
template<typename T>voidshowSTL(priority_queue<T> H);template<typename T>voidshowSTL(stack<T> H);
template<typename T,typename V>voidshowSTL(map<T,V> H);
template<typename T,typename V>voidshowSTL(multimap<T,V> H);template<typename T>voidshowSTL(vector<T> H);
template<typename T>voidshowSTL(set<T> H);template<typename T>voidshowSTL(multiset<T> H);
template<typename T>voidshowSTL(list<T> H);voidshowSTL(char *H);
template<typename T>voidshowSTL(deque<T> H);template<typename T>voidshowSTL(queue<T> H);
template<typename T>voidshowSTL(T H){stringstream ss;ss<<H;cerr<<ss.str();}
template<typename T,typename V>voidshowSTL(pair<T,V> H){cerr<<"(";showSTL(H.first);cerr<<"=>";showSTL(H.second);cerr<<")";}
template<typename T>voidshowSTL(priority_queue<T> H){cerr<<endl;while(!H.empty()){cerr<<H.top()<<endl;H.pop();}cerr<<endl;}
template<typename T>voidshowSTL(stack<T> H){cerr<<endl;while(!H.empty()){cerr<<H.top()<<endl;H.pop();}}
template<typename T,typename V>voidshowSTL(map<T,V> H){cerr<<"[ ";for(auto val:H){showSTL(val);cerr<<"";}cerr<<"]";}
template<typename T,typename V>voidshowSTL(multimap<T,V> H){cerr<<"[ ";for(auto val:H){showSTL(val);cerr<<"";}cerr<<"]";}
template<typename T>voidshowSTL(vector<T> H){cerr<<"[ ";for(auto val : H){showSTL(val);cerr<<'';}cerr<<"]";}
template<typename T>voidshowSTL(set<T> H){cerr<<"[ ";for(auto val : H){showSTL(val);cerr<<'';}cerr<<"]";}
template<typename T>voidshowSTL(multiset<T> H){cerr<<"[ ";for(auto val : H){showSTL(val);cerr<<'';}cerr<<"]";}
template<typename T>voidshowSTL(list<T> H){cerr<<"[ ";for(auto val : H){showSTL(val);cerr<<'';}cerr<<"]";}
voidshowSTL(char *H){for(int i=0;i<strlen(H);i++){showSTL(H[i]);};}
template<typename T>voidshowSTL(deque<T> H){cerr<<"[ ";for(auto val : H){showSTL(val);cerr<<'';}cerr<<"]";}
template<typename T>voidshowSTL(queue<T> H){cerr<<"[ ";while(!H.empty()){showSTL(H.front());cerr<<'';H.pop();}cerr<<"]";}
vector<string>vec_spltr(string s){s+=',';vector<string>res;while(!s.empty())
res.push_back(s.substr(0, s.find(','))),s=s.substr(s.find(',')+1);return res;}
voiddbg_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,__attribute__((unused))int LINE_NUM)
{cerr<<endl;}template<typename Head,typename... Tail>
voiddbg_out ( vector <string> args, int idx, intLINE_NUM, Head H, Tail... T)
{if(idx>0)cerr<<", ";else cerr << "Line(" << LINE_NUM << "):";
cerr<<""<<args[idx]<<" = ";showSTL(H);dbg_out(args,idx+1,LINE_NUM, T...);}
#definedebug(...) dbg_out(vec_spltr(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
boolCheck_ll_prime(ll n)
{
int odd = 0, even = 0, both = 0;
if(n&1){
while(n){
int tm = n%10; n/=10;
tm&1 ? odd += tm : even += tm; both += tm;
}
if(both < 10and both%3 == 0) returnfalse;
elseif(abs(odd-even)%11 == 0) returnfalse;
elsereturntrue;
}
elsereturnfalse;
}
// const int N = 1e4+7;
// vector<int>primes;
// bool pri[N];
// void sieve()
// {
// memset(pri, 1, sizeof(pri));
// for(int i=4; i<N; i+=2) pri[i] = 0;
// primes.pb(2);
// for(int i=3; i*i < N; i+=2)
// {
// if(pri[i])
// {
// primes.pb(i);
// for(int j=i*i; j<N; j+=i) pri[j] = 0;
// }
// }
// }
voidSakiBee()
{
ll p; cin >> p;
cout << Check_ll_prime(p) << endl;
}
//1000004249
Consummation
//S_Consummation
//Tc_Consummation
//Wrong doesn't mean bad