結果
| 問題 |
No.112 ややこしい鶴亀算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-10-18 17:59:45 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 727 bytes |
| コンパイル時間 | 3,853 ms |
| コンパイル使用メモリ | 76,428 KB |
| 実行使用メモリ | 42,552 KB |
| 最終ジャッジ日時 | 2024-11-06 20:13:07 |
| 合計ジャッジ時間 | 8,956 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 WA * 2 |
ソースコード
import java.util.Scanner;
public class Yuki4 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int leg[] = new int[n];
int x = 0;
int y = 0;
int z = -1;
for (int i = 0; i < n; i++) {
leg[i] = scan.nextInt();
}
for (int i = 0; i < n; i++) {
if (leg[0] == leg[i]) x++;
else z = i;
}
y = n - x;
if (2 * x + 4 * y == leg[0] + 2) {
if (z == -1) System.out.println(x + " " + y);
else if (2 * x + 4 * y == leg[z] + 4) System.out.println(x + " " + y);
}
else System.out.println(y + " " + x);
}
}