結果
問題 |
No.112 ややこしい鶴亀算
|
ユーザー |
![]() |
提出日時 | 2015-09-19 17:28:38 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 693 bytes |
コンパイル時間 | 2,031 ms |
コンパイル使用メモリ | 79,904 KB |
実行使用メモリ | 55,260 KB |
最終ジャッジ日時 | 2024-07-19 08:05:41 |
合計ジャッジ時間 | 6,620 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 WA * 10 |
ソースコード
import java.util.Arrays; import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int[] n = new int[sc.nextInt()]; int turu = 0, kame = 0; for(int i = 0; i < n.length; i++) n[i] = sc.nextInt(); Arrays.sort(n); if(n[0] != n[1] || n[n.length - 1] != n[n.length - 2]){ if((n[0] + n[1]) / 2 == 2 || (n[n.length - 1] + n[n.length - 2]) / 2 == 2){ kame = n.length - 1; turu = 1; } else{ turu = n.length - 1; kame = 1; } } else{ if(n[0] / (n.length - 1) == 2)turu = n.length; else kame = n.length; } System.out.println(turu + " " + kame); sc.close(); } }