No.736 Ratio Reduction
レベル :
/ AI推定難易度 : 189
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 328
作問者 :
butsurizuki
/ テスター :
yuki2006
タグ : / 解いたユーザー数 328
作問者 :
butsurizuki
/ テスター :
問題文最終更新日: 2018-09-28 17:18:48
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 200
(順位表)
の他の問題:
Problem Statement
There is a continued ratio $a_1:a_2:a_3...a_{N-1}:a_N$ consisting of $N$ natural numbers.
Dividing all terms of this ratio by the same natural number other than 1, in the manner of reducing a fraction, is called "ratio reduction".
Output the ratio that is equal to $a_1:a_2:a_3...a_{N-1}:a_N$ and cannot be reduced any further.
Input
$N$ $a_1 a_2 ... a_N$
The first line contains $N$, and the second line contains $a_i$ separated by spaces.
・Constraints
$2 \le N \le 100$
$1 \le a_i \le 10^{18} (1 \le i \le N)$
Output
Output the terms of the ratio separated by :, followed by a newline at the end.
Sample
Sample 1
Input
3 24 30 36
Output
4:5:6
Sample 2
Input
3 9 12 16
Output
9:12:16
Sample 3
Input
5 12 18 30 42 66
Output
2:3:5:7:11
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。