結果
問題 |
No.91 赤、緑、青の石
|
ユーザー |
![]() |
提出日時 | 2015-08-17 22:21:41 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 703 bytes |
コンパイル時間 | 2,151 ms |
コンパイル使用メモリ | 77,760 KB |
実行使用メモリ | 50,640 KB |
最終ジャッジ日時 | 2024-07-18 10:03:54 |
合計ジャッジ時間 | 4,076 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 WA * 7 |
ソースコード
import java.io.*; import java.util.Arrays; class Main{ static final PrintWriter out=new PrintWriter(System.out); public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=br.readLine(); int[] st=new int[3]; int ans=0; for(int i=0;i<3;i++) st[i]=Integer.parseInt(line.split(" ")[i]); Arrays.sort(st); if(st[0]==st[1]&&st[1]==st[2]) out.println(st[0]); else if(st[0]==st[1]){ ans+=st[0]; st[2]-=st[0]; ans+=(int)st[2]/5; out.println(ans); } else{ ans+=st[0]; st[1]-=st[0]; st[2]-=st[0]; int cnt=(int)(st[1]+st[2])/4; if((st[1]+st[2])%4==0&&st[1]==cnt+1) ans+=cnt-1; else ans+=cnt; out.println(ans); } out.flush(); } }