Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- ll arr[10000007];
- int main()
- {
- ll n,i,j,k,sz=1,carry,sum=0,b,c,d,a;
- while(cin>>n)
- {
- cout<<n<<"! --"<<endl;
- carry=0,sz=1,arr[0]=1,sum=0;
- ll one=0,two=0,three=0,four=0,five=0,six=0,seven=0,eight=0,nine=0,zero=0;
- for(i=1;i<=n;i++)
- {
- for(j=0;j<sz;j++)
- {
- a=arr[j]*i+carry;
- arr[j]=a%10;
- // sum+=arr[j];
- carry=a/10;
- }
- while(carry>0)
- {
- arr[sz]=carry%10;
- // sum+=arr[sz];
- carry/=10;
- sz++;
- }
- }
- for(i=sz-1;i>=0;i--)
- {
- if(arr[i]==0)
- zero++;
- else if(arr[i]==1)
- one++;
- else if(arr[i]==2)
- two++;
- else if(arr[i]==3)
- three++;
- else if(arr[i]==4)
- four++;
- else if(arr[i]==5)
- five++;
- else if(arr[i]==6)
- six++;
- else if(arr[i]==7)
- seven++;
- else if(arr[i]==8)
- eight++;
- else if(arr[i]==9)
- nine++;
- }
- printf(" (0) %lld (1) %lld (2) %lld (3) %lld (4) %lld\n",zero,one,two,three,four);
- printf(" (5) %lld (6) %lld (7) %lld (8) %lld (9) %lld\n",five,six,seven,eight,nine);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement