結果
問題 | No.1987 Sandglass Inconvenience |
ユーザー | tenten |
提出日時 | 2022-06-25 11:44:45 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 1,234 bytes |
コンパイル時間 | 2,156 ms |
コンパイル使用メモリ | 76,804 KB |
実行使用メモリ | 37,160 KB |
最終ジャッジ日時 | 2024-04-26 17:57:02 |
合計ジャッジ時間 | 4,594 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 48 ms
36,964 KB |
testcase_01 | AC | 49 ms
36,736 KB |
testcase_02 | AC | 48 ms
36,816 KB |
testcase_03 | AC | 48 ms
36,580 KB |
testcase_04 | AC | 49 ms
36,964 KB |
testcase_05 | AC | 49 ms
36,936 KB |
testcase_06 | AC | 48 ms
36,868 KB |
testcase_07 | AC | 47 ms
36,748 KB |
testcase_08 | AC | 50 ms
37,072 KB |
testcase_09 | AC | 50 ms
37,036 KB |
testcase_10 | AC | 50 ms
36,924 KB |
testcase_11 | AC | 49 ms
37,092 KB |
testcase_12 | AC | 48 ms
36,924 KB |
testcase_13 | AC | 48 ms
37,160 KB |
testcase_14 | AC | 48 ms
36,716 KB |
testcase_15 | AC | 47 ms
36,964 KB |
testcase_16 | AC | 50 ms
36,824 KB |
testcase_17 | AC | 50 ms
36,884 KB |
testcase_18 | AC | 50 ms
37,032 KB |
testcase_19 | AC | 50 ms
36,848 KB |
testcase_20 | AC | 50 ms
36,792 KB |
testcase_21 | AC | 51 ms
36,500 KB |
testcase_22 | AC | 50 ms
37,032 KB |
testcase_23 | AC | 50 ms
36,900 KB |
testcase_24 | AC | 50 ms
36,828 KB |
ソースコード
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); long gcd = getGCD(getGCD(sc.nextLong(), sc.nextLong()), sc.nextLong()); if (sc.nextLong() % gcd == 0) { System.out.println("Yes"); } else { System.out.println("No"); } } static long getGCD(long x, long y) { if (y == 0) { return x; } else { return getGCD(y, x % y); } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }