mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
26 lines
490 B
C++
26 lines
490 B
C++
|
#include <stdio.h>
|
||
|
#include <math.h>
|
||
|
#include <string.h>
|
||
|
const int MAXN=10030;
|
||
|
int a[MAXN];
|
||
|
int main(int argc, char *argv[])
|
||
|
{
|
||
|
long n;
|
||
|
while(scanf("%ld",&n) && n)
|
||
|
{
|
||
|
int count=1;
|
||
|
memset(a,0,sizeof(a));
|
||
|
a[n]=1;
|
||
|
while(1)
|
||
|
{
|
||
|
long t=n*n/100;
|
||
|
n=t%10000;
|
||
|
a[n]++;
|
||
|
if(a[n]==2) break;
|
||
|
count++;
|
||
|
}
|
||
|
printf("%d\n",count);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|