結果

問題 No.736 約比
ユーザー takeya_okino
提出日時 2019-08-18 22:21:57
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 410 bytes
コンパイル時間 2,457 ms
コンパイル使用メモリ 74,016 KB
実行使用メモリ 56,252 KB
最終ジャッジ日時 2024-10-01 14:33:48
合計ジャッジ時間 12,265 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 65
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long ans = sc.nextLong();
    for(int i = 1; i < n; i++) {
      long a = sc.nextLong();
      ans = gcd(ans, a);
    }
    System.out.println(ans);
  }

  public static long gcd(long a, long b) {
    if(b == 0) return a;
    return gcd(b, (a % b));
  }
}
0