結果
| 問題 |
No.333 門松列を数え上げ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-20 14:25:14 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,031 bytes |
| コンパイル時間 | 2,280 ms |
| コンパイル使用メモリ | 76,788 KB |
| 実行使用メモリ | 54,316 KB |
| 最終ジャッジ日時 | 2024-07-19 20:43:25 |
| 合計ジャッジ時間 | 6,451 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 1 TLE * 1 -- * 5 |
ソースコード
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long A = Integer.parseInt(sc.next());
long B = Integer.parseInt(sc.next());
long cnt = 0;
if (A > B) {
} else {
for (long i = 1; i < B; i++) {
if (isKadomatsu(A, B, i)) cnt++;
}
}
// for (long i = 0; i < 2000000000; i++) {
// if (isKadomatsu(A, B, i)) cnt++;
// }
System.out.println(cnt);
}
private static boolean isKadomatsu(long A, long B, long C) {
// System.out.println(A + " " + B + " " + C);
if (A == B || A == C || B == C) {
return false;
}
List<Long> num = new ArrayList<>();
num.add(A);
num.add(B);
num.add(C);
Collections.sort(num);
return num.get(1) == A || num.get(1) == C;
}
}