結果
問題 | No.1987 Sandglass Inconvenience |
ユーザー | tenten |
提出日時 | 2023-08-08 14:13:09 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 1,799 bytes |
コンパイル時間 | 3,009 ms |
コンパイル使用メモリ | 91,056 KB |
実行使用メモリ | 50,724 KB |
最終ジャッジ日時 | 2024-04-26 06:56:17 |
合計ジャッジ時間 | 4,437 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 49 ms
50,440 KB |
testcase_01 | AC | 47 ms
49,936 KB |
testcase_02 | AC | 49 ms
50,204 KB |
testcase_03 | AC | 50 ms
50,488 KB |
testcase_04 | AC | 50 ms
50,724 KB |
testcase_05 | AC | 51 ms
50,456 KB |
testcase_06 | AC | 48 ms
50,068 KB |
testcase_07 | AC | 48 ms
50,380 KB |
testcase_08 | AC | 48 ms
50,380 KB |
testcase_09 | AC | 49 ms
50,036 KB |
testcase_10 | AC | 47 ms
50,060 KB |
testcase_11 | AC | 50 ms
50,552 KB |
testcase_12 | AC | 49 ms
50,284 KB |
testcase_13 | AC | 48 ms
50,008 KB |
testcase_14 | AC | 49 ms
50,624 KB |
testcase_15 | AC | 48 ms
50,508 KB |
testcase_16 | AC | 49 ms
50,388 KB |
testcase_17 | AC | 47 ms
50,268 KB |
testcase_18 | AC | 47 ms
50,324 KB |
testcase_19 | AC | 47 ms
50,456 KB |
testcase_20 | AC | 48 ms
50,388 KB |
testcase_21 | AC | 48 ms
50,484 KB |
testcase_22 | AC | 48 ms
50,324 KB |
testcase_23 | AC | 49 ms
50,520 KB |
testcase_24 | AC | 50 ms
50,048 KB |
ソースコード
import java.io.*; import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); long gcd = getGCD(sc.nextLong(), getGCD(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 Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); 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 int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }