結果

問題 No.736 約比
ユーザー suikameron1suikameron1
提出日時 2018-11-10 12:38:45
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 844 bytes
コンパイル時間 904 ms
コンパイル使用メモリ 65,664 KB
実行使用メモリ 22,792 KB
最終ジャッジ日時 2023-08-15 19:29:21
合計ジャッジ時間 7,030 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
20,668 KB
testcase_01 AC 49 ms
20,648 KB
testcase_02 AC 48 ms
20,600 KB
testcase_03 AC 50 ms
20,660 KB
testcase_04 AC 49 ms
20,700 KB
testcase_05 AC 50 ms
20,684 KB
testcase_06 AC 49 ms
20,608 KB
testcase_07 AC 49 ms
22,792 KB
testcase_08 AC 49 ms
20,684 KB
testcase_09 AC 49 ms
20,644 KB
testcase_10 AC 50 ms
20,660 KB
testcase_11 AC 52 ms
20,528 KB
testcase_12 AC 50 ms
20,796 KB
testcase_13 AC 49 ms
20,768 KB
testcase_14 AC 48 ms
20,676 KB
testcase_15 AC 48 ms
20,548 KB
testcase_16 AC 49 ms
20,656 KB
testcase_17 AC 48 ms
20,752 KB
testcase_18 AC 49 ms
20,792 KB
testcase_19 AC 49 ms
20,680 KB
testcase_20 AC 49 ms
20,800 KB
testcase_21 AC 49 ms
20,688 KB
testcase_22 AC 50 ms
20,708 KB
testcase_23 AC 49 ms
20,624 KB
testcase_24 AC 49 ms
20,664 KB
testcase_25 AC 50 ms
20,616 KB
testcase_26 AC 48 ms
22,736 KB
testcase_27 AC 49 ms
20,648 KB
testcase_28 AC 50 ms
20,652 KB
testcase_29 AC 48 ms
20,556 KB
testcase_30 AC 49 ms
20,620 KB
testcase_31 AC 49 ms
18,504 KB
testcase_32 AC 49 ms
22,720 KB
testcase_33 AC 49 ms
20,656 KB
testcase_34 AC 52 ms
20,764 KB
testcase_35 AC 49 ms
20,668 KB
testcase_36 AC 51 ms
20,740 KB
testcase_37 AC 49 ms
20,752 KB
testcase_38 AC 50 ms
20,792 KB
testcase_39 AC 50 ms
20,616 KB
testcase_40 AC 50 ms
20,696 KB
testcase_41 AC 49 ms
20,732 KB
testcase_42 AC 48 ms
22,696 KB
testcase_43 AC 48 ms
20,620 KB
testcase_44 AC 49 ms
22,740 KB
testcase_45 AC 50 ms
20,624 KB
testcase_46 AC 49 ms
20,604 KB
testcase_47 AC 49 ms
20,664 KB
testcase_48 AC 49 ms
20,652 KB
testcase_49 AC 48 ms
20,704 KB
testcase_50 AC 50 ms
20,680 KB
testcase_51 AC 51 ms
22,752 KB
testcase_52 AC 51 ms
22,700 KB
testcase_53 AC 50 ms
22,708 KB
testcase_54 AC 48 ms
20,640 KB
testcase_55 AC 50 ms
20,668 KB
testcase_56 AC 48 ms
20,672 KB
testcase_57 AC 51 ms
20,608 KB
testcase_58 AC 50 ms
22,732 KB
testcase_59 AC 49 ms
20,728 KB
testcase_60 AC 50 ms
20,648 KB
testcase_61 AC 49 ms
20,616 KB
testcase_62 AC 50 ms
22,732 KB
testcase_63 AC 49 ms
20,600 KB
testcase_64 AC 50 ms
20,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		long n = long.Parse(Console.ReadLine());//long.Parseはstringをlongに変換。
		long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long gcd = nums[0];
    for(int i = 1; i < n; i++) gcd = Gcd(gcd, nums[i]);
    for(int i = 0; i < n; i++) nums[i] /= gcd;
    Console.WriteLine(string.Join(":", nums));
	}

  static long Gcd(long a, long b) 
      {//引数a,bの最大公約数を返す
           if (a < b)
               return Gcd(b, a);//入れ替え
           while (b != 0) 
           {
               long changeTo = a % b;
               a = b;
               b = changeTo;
           }
           return a;
       }

}
0