結果
問題 | No.339 何人が回答したのか |
ユーザー |
![]() |
提出日時 | 2018-10-05 14:29:37 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 25 ms / 1,000 ms |
コード長 | 765 bytes |
コンパイル時間 | 1,077 ms |
コンパイル使用メモリ | 102,784 KB |
実行使用メモリ | 17,792 KB |
最終ジャッジ日時 | 2024-10-12 12:32:34 |
合計ジャッジ時間 | 4,274 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 61 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; public class Hello { public static void Main() { var n = int.Parse(Console.ReadLine().Trim()); if (n == 1) { Console.ReadLine(); Console.WriteLine(1); goto end; } var a1 = int.Parse(Console.ReadLine().Trim()); var a2 = int.Parse(Console.ReadLine().Trim()); var ans = gcd(a1, a2); for (int i = 0; i < n -2; i++) { var w = int.Parse(Console.ReadLine().Trim()); ans = gcd(ans, w); } Console.WriteLine(100/ans); end:; } public static int gcd(int a, int b) { if (a < b) return gcd(b, a); while (b != 0) { var w = a % b; a = b; b = w; } return a; } }