问题标题: 酷町堂:1506 数字黑洞123 我哪里错分了???(我80分)

0
0
已解决
陶旭杰
陶旭杰
中级光能
中级光能

题目网址:

http://judge.codingtang.com/problem/1506/

我的代码:

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
int main()
{
    long long a,b[19],c=0,d,e=0,f=0,g=0;
    cin>>a;

    for(;a!=123;c++)
    {
        d=a;
        for(int i=1;d;i++)
        {
            b[i]=d%10;
            d/=10;
            if(b[i]%2==0)
            {
                e++;
            }
            else
            f++;
            g++;
        }
        if(g>=10)
        {
            a=e*1000+f*100+g;
         } 
         else
         {
            a=e*100+f*10+g;
         }
         e=0,f=0,g=0;
    }
    cout<<c;
    return 0;
}   

恳请各位大佬指点!!!


0
0
0
0
0
0
我要回答