PersonalCorpus 版 (精华区)

1127671 Big Guava ... 10018 Accepted
0:00.000 64 2002/09/29 00:10:35.065

#include "myfunc.c"

void main()
{
#ifndef ONLINE_JUDGE
    freopen("c:\\0acm\\uva\\i10018","r",stdin);
    freopen("c:\\0acm\\uva\\o10018","w",stdout);
#endif

    unsigned int k,t,sk;
    int sum,n;

    scanf("%d\n",&n);
    while (n--) {
        scanf("%u\n",&k);
        sum=0;
        while (1) {
            if (is_palindrome(k)) {
                printf("%d %u\n",sum,k);
                break;
            }
            t=0; sk=k;
            while (k>0) {
                t*=10;
                t+=k%10;
                k/=10;
            }
            k=sk+t;
            sum++;
        }
    }
}
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.304毫秒