#17570: 測資改了...一直TLE


happyman940815@gmail.com (【百鬼組】希格瑪 - 一位排球廢物高中生)


有人有想法嗎

(底下的是TLE呦,不要傻傻copy下來)

#include <iostream>
using namespace std;
main()
{
cin.tie(0);
ios::sync_with_stdio(false);

long long int a,b,c,d;
while(cin>>a>>b>>c){
d=a;
cout<<a<<" ";
for(int i=1; i<c; i++){
d=(d*d)%b;
cout<<d<<" ";
}
cout<<'\n';
}
}

#17571: Re:測資改了...一直TLE


asnewchien@gmail.com (david)


 

這個有循環,試一下。