Files
python/C++专题课程/历年试题与资料/蓝桥杯2018年试题C++/3.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

37 lines
1.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include<bits/stdc++.h>
using namespace std;
int main() {
//把题目的100个数字直接复制粘贴
int i;
int arr[100]= {
5650,4542,3554,473, 946, 4114, 3871, 9073, 90, 4329,
2758 ,7949, 6113,5659, 5245, 7432, 3051, 4434, 6704, 3594,
9937 ,1173 ,6866,3397 ,4759, 7557, 3070, 2287, 1453, 9899,
1486 ,5722 ,3135,1170, 4014, 5510, 5120, 729, 2880, 9019,
2049 ,698 ,4582,4346 ,4427, 646, 9742, 7340, 1230, 7683,
5693 ,7015 ,6887,7381, 4172, 4341, 2909, 2027, 7355, 5649,
6701 ,6645 ,1671,5978 ,2704, 9926, 295, 3125, 3878, 6785,
2066,4247 ,4800,1578, 6652, 4616, 1113, 6205, 3264, 2915,
3966,5291 ,2904,1285, 2193, 1428, 2265, 8730, 9436, 7074,
689,5510,8243,6114, 337, 4096, 8199, 7313, 3685, 211};
int num2=0,num5=0;
for(i=0; i<=99; i++) {
//共包含多少个2,多少个5
while(1) {
if( arr[i]%2==0 ) { //可以分解出2
num2++;
arr[i]/=2;
} else if( arr[i]%5==0 ) { //可以分解出5
num5++;
arr[i]/=5;
} else
break;
}
}
printf("%d",num2<num5?num2:num5);
return 0;
}