結果

問題 No.1987 Sandglass Inconvenience
ユーザー kusagame12
提出日時 2024-03-04 18:05:33
言語 Java
(openjdk 23)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 652 bytes
コンパイル時間 1,999 ms
コンパイル使用メモリ 83,776 KB
実行使用メモリ 54,340 KB
最終ジャッジ日時 2024-09-29 17:28:01
合計ジャッジ時間 6,290 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
       
        Scanner sc = new Scanner(System.in);
        
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long X = sc.nextLong();
        
        long gcd = gcd(a,gcd(b,c));
        
        System.out.println(X % gcd != 0 ? "No" : "Yes");
        
    }
    
    private static long gcd(long a, long b){
        
        long r = a % b;
    
        while(r != 0){
            a = b;
            b = r;
            r = a % b;
        }
    
        return b;
        
    }
   
}







0