manus_verda's blog

By manus_verda, history, 4 years ago, In English

1352A - Sum of Round Numbers I don't know why I'm wrong

include

include

using namespace std;

const int mxn=88; int t,n,res; int find(int x){ int k=0; while(x){ x/=10,k++; } return k; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cin>>t;

while(t--){
    res=0;
    cin>>n;
    int w=find(n);
    //cout<<w<<endl;
    int k=0,x=n,y=n;
    while(y%10==0)x/=10,y/=10;
    y=n;
    for(int i=0;i<w;i++,y/=10)
        if(y%10)res++;
    y=n;
    cout<<res<<endl;
    while(w-1!=k){
        while(y%10==0)k++,y/=10;
        if(k==w-1)break;
        cout<<(x%10)*pow(10,k)<<' ';
        n-=(x%10)*pow(10,k);
        y=n,x/=10,k=0;
    }
    cout<<n<<endl;
}

return 0;

}

  • Vote: I like it
  • -26
  • Vote: I do not like it

| Write comment?
»
4 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

nice clickbate