結果
問題 | No.736 約比 |
ユーザー |
|
提出日時 | 2019-02-17 12:57:46 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 1,558 bytes |
コンパイル時間 | 1,418 ms |
コンパイル使用メモリ | 114,660 KB |
実行使用メモリ | 18,176 KB |
最終ジャッジ日時 | 2024-09-25 06:30:39 |
合計ジャッジ時間 | 4,936 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 System.Collections.Generic; using System.Text; namespace AtTest.yukicoder { class _736 { static void Main(string[] args) { Method(args); Console.ReadLine(); } static void Method(string[] args) { int n = ReadInt(); long[] array = ReadLongs(); long gcd = array[0]; for(int i = 1; i < n; i++) { gcd = GCD(gcd, array[i]); } for(int i =0; i < n; i++) { Console.Write(array[i] / gcd); if (i < n - 1) Console.Write(":"); } } static long GCD(long x,long y) { long a = Math.Max(x, y); long b = Math.Min(x, y); while (b > 0) { long tmp = b; b = a % b; a = tmp; } return a; } private static string Read() { return Console.ReadLine(); } private static int ReadInt() { return int.Parse(Read()); } private static long ReadLong() { return long.Parse(Read()); } private static double ReadDouble() { return double.Parse(Read()); } private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); } private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); } private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); } } }