結果

問題 No.91 赤、緑、青の石
ユーザー holegumaholeguma
提出日時 2015-08-17 22:38:45
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 776 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 74,988 KB
実行使用メモリ 53,072 KB
最終ジャッジ日時 2023-09-25 12:39:48
合計ジャッジ時間 5,939 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 44 ms
50,196 KB
testcase_07 AC 44 ms
50,164 KB
testcase_08 AC 44 ms
49,968 KB
testcase_09 AC 44 ms
49,956 KB
testcase_10 AC 44 ms
50,124 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 44 ms
50,176 KB
testcase_17 AC 45 ms
49,972 KB
testcase_18 AC 44 ms
50,584 KB
testcase_19 AC 43 ms
50,008 KB
testcase_20 AC 43 ms
48,132 KB
testcase_21 AC 43 ms
50,328 KB
testcase_22 AC 43 ms
50,088 KB
testcase_23 AC 43 ms
50,020 KB
testcase_24 AC 44 ms
49,956 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 44 ms
50,012 KB
testcase_28 AC 44 ms
47,984 KB
testcase_29 AC 44 ms
50,008 KB
testcase_30 AC 44 ms
50,272 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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];
if(3*st[1]<=st[2]){
ans+=st[1];
st[2]-=3*st[1];
ans+=(int)st[2]/5;
}
else{
while(st[2]>=3&&st[1]>0){
ans++;
st[1]--;
st[2]-=3;
Arrays.sort(st);
}
ans+=(int)st[2]/5;
}
out.println(ans);
}
out.flush();
}
}
0