結果
問題 |
No.1366 交換門松列・梅
|
ユーザー |
![]() |
提出日時 | 2021-01-29 21:35:10 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 120 ms / 1,000 ms |
コード長 | 862 bytes |
コンパイル時間 | 2,320 ms |
コンパイル使用メモリ | 79,988 KB |
実行使用メモリ | 46,568 KB |
最終ジャッジ日時 | 2025-06-20 10:56:47 |
合計ジャッジ時間 | 4,518 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int[] a = new int[3]; for (int i = 0; i < 3; i++) { a[i] = sc.nextInt(); } int[] b = new int[3]; for (int i = 0; i < 3; i++) { b[i] = sc.nextInt(); } sc.close(); if (check(a) && check(b)) { System.out.println("Yes"); return; } for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { int t = a[i]; a[i] = b[j]; b[j] = t; if (check(a) && check(b)) { System.out.println("Yes"); return; } t = a[i]; a[i] = b[j]; b[j] = t; } } System.out.println("No"); } static boolean check(int[] a) { if (a[0] != a[2]) { if (a[0] < a[1] && a[1] > a[2]) return true; if (a[0] > a[1] && a[1] < a[2]) return true; } return false; } }