blob: 24ced19369a63c713d520e404544e84407c50867 (
plain) (
blame)
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
|
#include <iostream>
int main() {
const unsigned int SIZE = 8;
unsigned int nums[SIZE];
for (unsigned int i = 0; i < SIZE; i++)
std::cin >> nums[i];
unsigned int divisor = nums[0];
while (divisor > 1) {
bool is_gcd = true;
for (unsigned int i = 0; i < SIZE && is_gcd; i++)
if (nums[i] % divisor != 0)
is_gcd = false;
if (is_gcd) break;
divisor--;
}
std::cout << divisor << std::endl;
return 0;
}
|