-
Notifications
You must be signed in to change notification settings - Fork 0
/
20_2.cpp
53 lines (40 loc) · 872 Bytes
/
20_2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include<iostream>
#include<vector>
using namespace std;
int main(){
int fact = 100,size =1;
vector<int> num;
num.push_back(1);
for(int i=fact;i>1;i--){
for(int j=0;j<size;j++){
num[j] *= i;
}
if(num.back()>=100&&num.back()<1000){
num.push_back(0);
num.push_back(0);
size+=2;
}
else if(num.back()<100&&num.back()>=10){
num.push_back(0);
size+=1;
}
for(int j=0;j<size;j++){
if(num[j]>=100&&num[j]<1000){
num[j+2] += num[j]/100;
num[j+1] += (num[j]/10)%10;
num[j] = num[j]%10;
}
else if(num[j]>=1000){
num[j+3] += num[j]/1000;
num[j+2] += (num[j]/100)%10;
num[j+1] += (num[j]/10)%10;
num[j] = num[j]%10;
}
else if(num[j]<100&&num[j]>=10){
num[j+1] += num[j]/10;
num[j] = num[j]%10;
}
}
}
cout<<size;
}