結果

問題 No.91 赤、緑、青の石
ユーザー holegumaholeguma
提出日時 2015-08-17 22:48:06
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 785 bytes
コンパイル時間 2,151 ms
コンパイル使用メモリ 74,136 KB
実行使用メモリ 54,972 KB
最終ジャッジ日時 2023-09-25 12:39:55
合計ジャッジ時間 6,624 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 46 ms
50,368 KB
testcase_08 AC 46 ms
49,956 KB
testcase_09 AC 45 ms
47,928 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 46 ms
50,072 KB
testcase_17 AC 45 ms
49,976 KB
testcase_18 AC 45 ms
50,224 KB
testcase_19 AC 44 ms
50,640 KB
testcase_20 AC 45 ms
50,180 KB
testcase_21 AC 45 ms
49,980 KB
testcase_22 AC 45 ms
50,136 KB
testcase_23 AC 45 ms
50,224 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 93 ms
52,064 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[0]=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