Save the child

Revision en1, by manus_verda, 2023-01-20 16:16:06

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;

}

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English manus_verda 2023-01-20 16:16:06 870 Initial revision (published)