結果
問題 |
No.736 約比
|
ユーザー |
|
提出日時 | 2018-09-29 00:55:07 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 155 ms / 2,000 ms |
コード長 | 869 bytes |
コンパイル時間 | 2,057 ms |
コンパイル使用メモリ | 79,280 KB |
実行使用メモリ | 41,844 KB |
最終ジャッジ日時 | 2024-10-12 07:50:27 |
合計ジャッジ時間 | 12,573 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 65 |
ソースコード
import java.util.Scanner; class Main { public static long gcd(long x, long y) { long r; if (y > x) { r = x; x = y; y = r; } while (y > 0) { r = x % y; x = y; y = r; } return x; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long a[] = new long[N], tmp[] = new long[N]; for (int i = 0; i < N; ++i) { a[i] = sc.nextLong(); tmp[i] = a[i]; } sc.close(); for (int i = 1; i < N; ++i) tmp[i] = gcd(tmp[i - 1], tmp[i]); for (int i = 0; i < N; ++i) { System.out.print(a[i] / tmp[N - 1]); if (i != N - 1) System.out.print(":"); } } }