模拟题
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int p[1000000]; int main(){ int n; while(scanf("%d",&n)!=EOF){ memset(p,0,sizeof(p)); int i; for(i=1;;i++){ n/=10; n%=10000; n*=n; n%=1000000; if(p[n]>0){ break; } p[n]=i; } printf("%d %d %d ",n,i-p[n],i); } return 0; }