結果
問題 | No.736 約比 |
ユーザー |
![]() |
提出日時 | 2018-09-28 22:38:58 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 1,040 bytes |
コンパイル時間 | 1,837 ms |
コンパイル使用メモリ | 112,936 KB |
実行使用メモリ | 26,260 KB |
最終ジャッジ日時 | 2024-10-12 06:55:53 |
合計ジャッジ時間 | 3,919 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 65 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using static System.Console; using static System.Math; public class Hello{ public static void Main(){ int kazu = int.Parse(ReadLine()); string[] input = ReadLine().Split(' '); long[] a = new long[kazu]; long[] b = new long[kazu]; for(int i=0;i<kazu;i++){ a[i] = long.Parse(input[i]); b[i] = a[i]; } while(a[0]%a[1] !=0 && a[1]%a[0] !=0){ a[0] %= a[1]; if(a[1] % a[0] != 0){ a[1] %= a[0]; } } long min = Min(a[0],a[1]); for(int i=2;i<kazu;i++){ if(a[i] % min != 0){ while(a[i]%min !=0 && min%a[i] !=0){ a[i] %= min; if(min % a[i] != 0){ min %= a[i]; } } min = Min(min,a[i]); } } for(int i=0;i<kazu-1;i++){ Write("{0}:",b[i]/min); } WriteLine(b[kazu-1]/min); } }