結果
問題 | No.2776 Bigger image |
ユーザー | tenten |
提出日時 | 2024-06-10 15:40:00 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 47 ms / 2,000 ms |
コード長 | 2,120 bytes |
コンパイル時間 | 3,008 ms |
コンパイル使用メモリ | 78,312 KB |
実行使用メモリ | 37,156 KB |
最終ジャッジ日時 | 2024-06-10 15:40:06 |
合計ジャッジ時間 | 5,089 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
36,968 KB |
testcase_01 | AC | 45 ms
37,104 KB |
testcase_02 | AC | 44 ms
37,012 KB |
testcase_03 | AC | 44 ms
37,128 KB |
testcase_04 | AC | 44 ms
37,068 KB |
testcase_05 | AC | 44 ms
36,656 KB |
testcase_06 | AC | 45 ms
36,812 KB |
testcase_07 | AC | 44 ms
36,832 KB |
testcase_08 | AC | 44 ms
36,912 KB |
testcase_09 | AC | 44 ms
37,064 KB |
testcase_10 | AC | 44 ms
37,024 KB |
testcase_11 | AC | 45 ms
36,784 KB |
testcase_12 | AC | 47 ms
37,060 KB |
testcase_13 | AC | 44 ms
37,156 KB |
testcase_14 | AC | 44 ms
36,948 KB |
testcase_15 | AC | 44 ms
36,656 KB |
testcase_16 | AC | 44 ms
36,880 KB |
testcase_17 | AC | 43 ms
36,896 KB |
testcase_18 | AC | 44 ms
36,796 KB |
testcase_19 | AC | 45 ms
36,556 KB |
testcase_20 | AC | 45 ms
36,600 KB |
testcase_21 | AC | 45 ms
36,964 KB |
testcase_22 | AC | 44 ms
37,020 KB |
testcase_23 | AC | 45 ms
37,144 KB |
testcase_24 | AC | 45 ms
36,840 KB |
testcase_25 | AC | 44 ms
36,860 KB |
testcase_26 | AC | 45 ms
37,024 KB |
testcase_27 | AC | 44 ms
37,060 KB |
testcase_28 | AC | 44 ms
36,996 KB |
ソースコード
import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int a = sc.nextInt(); int b = sc.nextInt(); int h = sc.nextInt(); int w = sc.nextInt(); Num strait = new Num(h, a).min(new Num(w, b)); Num rotate = new Num(w, a).min(new Num(h, b)); int ans = strait.compareTo(rotate); if (ans < 0) { System.out.println("Rotating"); } else if (ans == 0) { System.out.println("Same"); } else { System.out.println("Non-rotating"); } } static class Num implements Comparable<Num> { int child; int mother; public Num(int child, int mother) { this.child = child; this.mother = mother; } public Num min(Num another) { if (compareTo(another) < 0) { return this; } else { return another; } } public int compareTo(Num another) { return child * another.mother - another.child * mother; } } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }