/***
Md. Namzul Hasan
Shahjalal University of Science & Technology,Sylhet.
hasan08sust@gmail.com
***/
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define load(array,size) for(int i=0 ; i<size ; i++) cin>>array[i] ;
#define new_line pf("\n")
#define clear_data(array) memset(array,0,sizeof(array))
#define highest_int 2147483647
vector<int> data ,jak;
int x[101] ;
int main()
{
int n,i,a,j,c,k,p ;
while(sc("%d",&n)==1 &&n)
{
data.pb(1) ;
for(i=2 ; i<=n ; i++)
{
c =0 ,k =0 ;
for(j=0 ; j<data.size() ; j++)
{
p = data[j]*i + c ;
//t = p%10 ;
jak.pb(p%10) ;
c = p/10 ;
}
while(c!=0)
{
jak.pb(c%10) ;
c/=10 ;
}
data.clear() ;
data = jak ;
jak.clear() ;
}
memset(x,0,sizeof(x)) ;
for(i=0 ; i<data.size() ; i++)
{
x[data[i]]++ ;
}
pf("%d! --\n",n) ;
for(i=0 ;i<=9 ;i++)
{
if(i==5)
pf("\n") ;
pf(" (%d) %5d",i,x[i]) ;
}
pf("\n") ;
data.clear() ;
}
return 0;
}
Md. Namzul Hasan
Shahjalal University of Science & Technology,Sylhet.
hasan08sust@gmail.com
***/
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define load(array,size) for(int i=0 ; i<size ; i++) cin>>array[i] ;
#define new_line pf("\n")
#define clear_data(array) memset(array,0,sizeof(array))
#define highest_int 2147483647
vector<int> data ,jak;
int x[101] ;
int main()
{
int n,i,a,j,c,k,p ;
while(sc("%d",&n)==1 &&n)
{
data.pb(1) ;
for(i=2 ; i<=n ; i++)
{
c =0 ,k =0 ;
for(j=0 ; j<data.size() ; j++)
{
p = data[j]*i + c ;
//t = p%10 ;
jak.pb(p%10) ;
c = p/10 ;
}
while(c!=0)
{
jak.pb(c%10) ;
c/=10 ;
}
data.clear() ;
data = jak ;
jak.clear() ;
}
memset(x,0,sizeof(x)) ;
for(i=0 ; i<data.size() ; i++)
{
x[data[i]]++ ;
}
pf("%d! --\n",n) ;
for(i=0 ;i<=9 ;i++)
{
if(i==5)
pf("\n") ;
pf(" (%d) %5d",i,x[i]) ;
}
pf("\n") ;
data.clear() ;
}
return 0;
}
No comments:
Post a Comment