| ||||||||||
| 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 | |||||||||
好水~~~~~~~Problem: 2183 User: langx
Memory: 164K Time: 0MS
Language: C++ Result: Accepted
---------------------------
#include <iostream>
using namespace std;
const unsigned MAX_SIZE = 50;
bool loop;
int n, m4, shrunk[MAX_SIZE];
int main(){
int i, k;
scanf("%d", &n);
loop = true;
for ( i = 0; ; ++i ) {
n /= 10;
m4 = n % 10000;
n = m4 * m4;
if(n > 999999)
n %= 1000000;
shrunk[i] = n;
for ( k = 0; k < i; ++k ) {
if(shrunk[k] == n ){
loop = false;
break;
}
}
if(!loop)break;
}
printf("%d %d %d\n",shrunk[i], i - k, i + 1);
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator