Contest2593 - 【C2】暑期csp快准狠练习(吴)
2024-07-10 12:00:00
3333-07-10 16:00:00
信息与公告
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int m=n; int num=0; //总张数 int x=n/100; num+=x; n%=100; int y=n/50; num+=y; n%=50; int z=n/20; num+=z; n%=20; int a=n/10; num+=a; n%=10; int b=n/5; num+=b; n%=5; int c=n; num+=c; cout<<num<<endl; int flag=0; //0代表还没输出 while(m>0){ if(flag==1){ cout<<"+"; } if(m>=100){ m-=100; cout<<100; } else if(m>=50){ m-=50; cout<<50; } else if(m>=20){ m-=20; cout<<20; } else if(m>=10){ m-=10; cout<<10; } else if(m>=5){ m-=5; cout<<5; } else if(m>=1){ m-=1; cout<<1; } flag=1; } }