1 #include<bits/stdc++.h>
2 using namespace std;
3 typedef long long LL;
4 LL mod_pow(LL base,LL n,LL mod){//快速幂
5 LL res=1;
6 while(n){
7 if(n&1)res=res*base%mod;
8 base=base*base%mod;
9 n>>=1;
10 }
11 return res;
12 }
13 int main(){
14 LL sum=0;//测试
15 for(int i=100000;i<1000000;++i){
16 sum=(mod_pow(2,i,5)+mod_pow(3,i,5)+mod_pow(4,i,5)+1)%5;
17 cout<<i<<' '<<sum<<endl;
18 if(i%4==0)cout<<i<<"是可以的"<<endl;
19 }
20 return 0;
21 }
1 #include<bits/stdc++.h>
2 using namespace std;
3 char s[100005];
4 int main(){
5 while(cin>>s){
6 int sum=0,j=0;
7 while(s[j]=='0')++j;//去掉前导0
8 for(int i=j;i<(int)strlen(s);++i)
9 sum=(sum*10+(s[i]-'0')%4)%4;//同余方程
10 if(sum%4)cout<<'0'<<endl;//规律
11 else cout<<'4'<<endl;
12 }
13 return 0;
14 }