結果
問題 | No.112 ややこしい鶴亀算 |
ユーザー |
![]() |
提出日時 | 2022-05-16 19:01:58 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 158 ms / 5,000 ms |
コード長 | 665 bytes |
コンパイル時間 | 3,736 ms |
コンパイル使用メモリ | 77,444 KB |
実行使用メモリ | 42,600 KB |
最終ジャッジ日時 | 2024-09-14 11:53:04 |
合計ジャッジ時間 | 8,736 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
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(); } }