链接:http://lightoj.com/volume_showproblem.php?problem=1163

题意:一个数A,把它的最后一个数字去掉,得到一个新数B,给出A-B的值,求A。

思路:找一下A,B,A-B之间的关系就行了。

#include<cstdio>
using namespace std;

typedef unsigned long long LL;

int main()
{
    int t,ca=1;
    LL c,a,b;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%llu",&c);
        printf("Case %d:",ca++);
        for(int i=9;i>=0;i--)
        {
            b=(c-i)*10;
            if(b%9==0)
            {
                a=b/9+i;
                printf(" %llu",a);
            }
        }
        printf("\n");
    }
    return 0;
}

 

 

 posted on 2013-07-22 22:04  ∑求和  阅读(159)  评论(0编辑  收藏  举报