Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
怎么老是超时呢?郁闷 附代码: #include <iostream> #include <cmath> using namespace std; void main() { int z,m,h; cin>>z; for(int i=0;i<z;i++) { int a,b; __int64 ans=1,sum=0; cin>>m>>h; for(int j=0;j<h;j++) { scanf("%d%d",&a,&b); ans=1; for(int k=0;k<b;k++) ans=ans*a%m; sum=(sum+ans)%m; } printf("%d",sum); cout<<endl; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator