結果
| 問題 |
No.2776 Bigger image
|
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2024-06-10 15:40:00 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 55 ms / 2,000 ms |
| コード長 | 2,120 bytes |
| コンパイル時間 | 3,095 ms |
| コンパイル使用メモリ | 80,604 KB |
| 実行使用メモリ | 51,328 KB |
| 最終ジャッジ日時 | 2025-01-02 07:28:38 |
| 合計ジャッジ時間 | 5,142 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 25 |
ソースコード
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();
}
}
}
tenten