Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- int v[10];
- int main(){
- ifstream f1("atestat.in");
- ofstream f2("atestat.out");
- int64_t n,x;
- int s=0,maxim=0,i=0,y;
- f1>>n;
- x=n;
- while(x != 0){
- y=x%10;
- if(maxim < y)
- maxim=y;
- s=s+y;
- v[y]++;
- x=x/10;
- }
- f2<<s<<" "<<maxim<<endl;
- for(i=0;i<=maxim;i++)
- f2<<v[i]<<" ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement