Codeforces Round #260 (Div. 2) B. Fedya and Maths
2014-08-09 12:53
363 查看
题目链接:点击打开链接
打表后发现规律,只有n%4==0时输出4否则输出0
代码:
打表后发现规律,只有n%4==0时输出4否则输出0
代码:
#include <iostream> #include <cmath> #include <cstring> using namespace std; char c[1000000]; int main(){ while(cin>>c){ int len=strlen(c); int n; if(len<=1){ n=c[len-1]-'0'; } else{ n=(c[len-2]-'0')*10+(c[len-1]-'0'); } if(n%4) cout<<0<<endl; else cout<<4<<endl; memset(c,0,sizeof(c)); } return 0; } //打表代码 /*long long pow(int i,int j){ long long res=1; for(int k=1;k<=j;k++){ res*=i; res%=5; } return res; } int main(){ for(int i=1;i<=100;i++){ cout<<i<<" "<<(pow(1,i)+pow(2,i)+pow(3,i)+pow(4,i))%5<<endl; } }*/
相关文章推荐
- Codeforces Round #260 (Div. 2) B. Fedya and Maths
- Codeforces Round #260 (Div. 2) B. Fedya and Maths【超数范围的取模】
- Codeforces Round #260 (Div. 2) B. Fedya and Maths(循环结)
- Codeforces Round #260 (Div. 2) B. Fedya and Maths
- Codeforces Round #260 (Div. 2)B. Fedya and Maths
- Codeforces Round #260 (Div. 2) B. Fedya and Maths
- Codeforces Round #260 (Div. 2)B. Fedya and Maths
- Codeforces Round #260 (Div. 2) B. Fedya and Maths(循环节)
- Codeforces Round #260 (Div. 2)B. Fedya and Maths
- Codeforces #260 (Div. 2) B. Fedya and Maths(数学:水题)
- Codeforces Round #260 (Div. 2)B. Fedya and Maths
- codeforce 2014808 B. Fedya and Maths
- Codeforces 260 B. Fedya and Maths
- CF 260 B. Fedya and Maths
- cf 456B - Fedya and Maths
- CF 456B(Fedya and Maths-找循环节)
- Fedya and Maths
- codeforces #260 B. Fedya and Maths(水)
- B. Fedya and Maths
- Codeforces 318 div2.D Bear and Blocks(dp,贪心)