結果

問題 No.112 ややこしい鶴亀算
ユーザー キョウチクキョウチク
提出日時 2022-05-16 19:01:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 154 ms / 5,000 ms
コード長 665 bytes
コンパイル時間 3,267 ms
コンパイル使用メモリ 74,640 KB
実行使用メモリ 57,120 KB
最終ジャッジ日時 2023-10-12 12:52:47
合計ジャッジ時間 8,426 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
56,844 KB
testcase_01 AC 145 ms
57,004 KB
testcase_02 AC 145 ms
56,888 KB
testcase_03 AC 146 ms
56,908 KB
testcase_04 AC 146 ms
56,832 KB
testcase_05 AC 146 ms
57,120 KB
testcase_06 AC 149 ms
56,744 KB
testcase_07 AC 150 ms
56,904 KB
testcase_08 AC 148 ms
56,672 KB
testcase_09 AC 145 ms
57,120 KB
testcase_10 AC 145 ms
57,012 KB
testcase_11 AC 149 ms
56,852 KB
testcase_12 AC 148 ms
56,952 KB
testcase_13 AC 147 ms
56,960 KB
testcase_14 AC 147 ms
56,812 KB
testcase_15 AC 146 ms
56,808 KB
testcase_16 AC 146 ms
56,596 KB
testcase_17 AC 149 ms
56,688 KB
testcase_18 AC 148 ms
56,740 KB
testcase_19 AC 147 ms
56,708 KB
testcase_20 AC 149 ms
56,520 KB
testcase_21 AC 152 ms
56,888 KB
testcase_22 AC 154 ms
56,972 KB
testcase_23 AC 150 ms
56,764 KB
testcase_24 AC 152 ms
56,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Test10 {
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String[] line;
    line=sc.nextLine().split(" ");
    int n=Integer.parseInt(line[0]);
    line=sc.nextLine().split(" ");
    int[] foot=new int[n];
    int foot_sum=0;
    for(int i=0;i<n;i++){
      foot[i]=Integer.parseInt(line[i]);
      foot_sum+=foot[i];
    }
    foot_sum/=n-1;
    int turu=0,turtle=0;
    for(int i=0;i<n;i++){
      switch(foot_sum-foot[i]){
      case 2:
        turu++;
        break;
      case 4:
        turtle++;
        break;
      }
    }
    System.out.println(turu+" "+turtle);
    sc.close();
  }
}
0