solution.md 2.3 KB
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# 乘积尾零
如下的10行数据,每行有10个整数,请你求出它们的乘积的末尾有多少个零?
```
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
```

## aop
### before
```cpp
每日一练社区's avatar
每日一练社区 已提交
19 20
#include <iostream>
using namespace std;
每日一练社区's avatar
每日一练社区 已提交
21 22 23 24 25 26 27 28
```
### after
```cpp

```

## 答案
```cpp
每日一练社区's avatar
每日一练社区 已提交
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
int main()
{
    int count2 = 0, count5 = 0;
    int num;
    for (int i = 0; i < 100; i++)
    {
        cin >> num;
        while (num % 5 == 0)
        {
            count5++;
            num /= 5;
        }
        while (num % 2 == 0)
        {
            count2++;
            num /= 2;
        }
    }
    int ans = count2 < count5 ? count2 : count5;
    cout << ans;
    return 0;
}
每日一练社区's avatar
每日一练社区 已提交
51 52 53 54 55
```
## 选项

### A
```cpp
每日一练社区's avatar
每日一练社区 已提交
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
int main()
{
    int count2 = 0, count5 = 0;
    int num;
    for (int i = 0; i < 100; i++)
    {
        cin >> num;
        while (num % 5 == 0)
        {
            count5++;
            num /= 5;
        }
        while (num % 2 == 0)
        {
            count2++;
            num /= 2;
        }
    }
    int ans = count2 < count5 ? count5 : count2;
    cout << ans;
    return 0;
}
每日一练社区's avatar
每日一练社区 已提交
78 79 80 81
```

### B
```cpp
每日一练社区's avatar
每日一练社区 已提交
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
int main()
{
    int count2 = 0, count5 = 0;
    int num;
    for (int i = 0; i < 100; i++)
    {
        cin >> num;
        while (num % 5 == 0)
        {
            count5++;
            num %= 5;
        }
        while (num % 2 == 0)
        {
            count2++;
            num %= 2;
        }
    }
    int ans = count2 < count5 ? count2 : count5;
    cout << ans;
    return 0;
}
每日一练社区's avatar
每日一练社区 已提交
104 105 106 107 108

```

### C
```cpp
每日一练社区's avatar
每日一练社区 已提交
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
int main()
{
    int count2 = 0, count5 = 0;
    int num;
    for (int i = 0; i < 100; i++)
    {
        cin >> num;
        while (num % 5 == 0)
        {
            count5++;
            num += 5;
        }
        while (num % 2 == 0)
        {
            count2++;
            num += 2;
        }
    }
    int ans = count2 < count5 ? count2 : count5;
    cout << ans;
    return 0;
}
每日一练社区's avatar
每日一练社区 已提交
131
```