結果
問題 | No.112 ややこしい鶴亀算 |
ユーザー | k_kadora |
提出日時 | 2015-05-25 23:40:46 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 728 bytes |
コンパイル時間 | 3,818 ms |
コンパイル使用メモリ | 76,000 KB |
実行使用メモリ | 60,948 KB |
最終ジャッジ日時 | 2023-09-20 13:13:01 |
合計ジャッジ時間 | 11,810 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 151 ms
56,704 KB |
testcase_01 | AC | 151 ms
57,012 KB |
testcase_02 | AC | 152 ms
56,792 KB |
testcase_03 | AC | 150 ms
56,796 KB |
testcase_04 | AC | 150 ms
56,784 KB |
testcase_05 | AC | 151 ms
54,468 KB |
testcase_06 | WA | - |
testcase_07 | TLE | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
ソースコード
import java.util.*; public class Tsurukame { public static void main(String[] arg){ Scanner sc = new Scanner(System.in); int n,tsuru,kame,sum,temp,flag; n = sc.nextInt(); int[] leg = new int[n]; for(int i = 0;i<n;i++){ leg[i] = sc.nextInt(); } sum = leg[0]; kame = (sum - 2*(n-1))/2; tsuru = n - kame -1; if( kame == n-1 || tsuru == n - 1){ if ( leg[0] - leg[1] == 0){ if(kame>0){ kame++; }else{ tsuru++; } }else{ if(kame>0){ tsuru++; }else{ kame++; } } }else{ int j = 0; while(j<n){ if(leg[j] != leg[j+1])break; } if(leg[j] - leg[j+1] == 2){ kame++; }else{ tsuru++; } } System.out.println(tsuru+" "+kame); } }