302046: CF389A. Fox and Number Game
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Fox and Number Game
题意翻译
有$N(1\leq N\leq 100)$个数$x_1,x_2,..,x_n$。 可以根据需要多次执行以下操作:选择两个不同的下标 $i$ 和 $j$,保持 $x_i > x_j$ ,然后令 $x_i \gets x_i - x_j$。 目标是使所有数字的总和尽可能小。 请找到这个最小的金额。题目描述
Fox Ciel is playing a game with numbers now. Ciel has $ n $ positive integers: $ x_{1} $ , $ x_{2} $ , ..., $ x_{n} $ . She can do the following operation as many times as needed: select two different indexes $ i $ and $ j $ such that $ x_{i} $ > $ x_{j} $ hold, and then apply assignment $ x_{i} $ = $ x_{i} $ - $ x_{j} $ . The goal is to make the sum of all numbers as small as possible. Please help Ciel to find this minimal sum.输入输出格式
输入格式
The first line contains an integer $ n $ ( $ 2<=n<=100 $ ). Then the second line contains $ n $ integers: $ x_{1} $ , $ x_{2} $ , ..., $ x_{n} $ ( $ 1<=x_{i}<=100 $ ).
输出格式
Output a single integer — the required minimal sum.
输入输出样例
输入样例 #1
2
1 2
输出样例 #1
2
输入样例 #2
3
2 4 6
输出样例 #2
6
输入样例 #3
2
12 18
输出样例 #3
12
输入样例 #4
5
45 12 27 30 18
输出样例 #4
15