找规律。。&&http://acm.hdu.edu.cn/showproblem.php?pid=1097
2012-01-07 10:39
591 查看
#include<iostream> #include<string.h> using namespace std; int hash[10]; int main() { long long a,b; int i; while(cin>>a>>b) { memset(hash,0,sizeof(hash)); hash[0]=a%10; for( i=1;i<11;++i) { hash[i]=(hash[i-1]*a)%10; if(hash[i]==hash[0]) break; } b=b%i; if(b) cout<<hash[b-1]<<endl; else cout<<hash[i-1]<<endl; }return 0; }
相关文章推荐
- A C&&http://acm.hdu.edu.cn/showproblem.php?pid=1570
- Trouble&&http://acm.hdu.edu.cn/showproblem.php?pid=4334
- 最小路径覆盖&&http://acm.hdu.edu.cn/showproblem.php?pid=4160
- I NEED A OFFER! &&http://acm.hdu.edu.cn/showproblem.php?pid=1203
- Text Reverse&&http://acm.hdu.edu.cn/showproblem.php?pid=1062
- Buy the Ticket&&http://acm.hdu.edu.cn/showproblem.php?pid=1133
- http://acm.hdu.edu.cn/webcontest/contest_showproblem.php?pid=1004&ojid=1&cid=6866&hide=1&problem=Pro
- 完数 &&http://acm.hdu.edu.cn/showproblem.php?pid=1406
- Red and Black&&http://acm.hdu.edu.cn/showproblem.php?pid=1312
- The 36th ACM/ICPC Asia Regional Beijing Site&&http://acm.hdu.edu.cn/showproblem.php?pid=4046
- 二分查找求函数的区间最小值&&http://acm.hdu.edu.cn/showproblem.php?pid=2899
- Robberies&&http://acm.hdu.edu.cn/showproblem.php?pid=2955
- Clairewd’s message&&http://acm.hdu.edu.cn/showproblem.php?pid=4300
- http://acm.hdu.edu.cn/showproblem.php?pid=1020&&encoding
- http://acm.hdu.edu.cn/webcontest/contest_showproblem.php?cid=791&pid=1001&ojid=0
- Quoit Design&&http://acm.hdu.edu.cn/showproblem.php?pid=1007
- HDU Today&&http://acm.hdu.edu.cn/showproblem.php?pid=2112
- http://acm.hdu.edu.cn/showproblem.php?pid=1059&&多重背包
- Holedox Eating &&http://acm.hdu.edu.cn/showproblem.php?pid=4302
- Number Sequence&&http://acm.hdu.edu.cn/showproblem.php?pid=1005