結果

問題 No.91 赤、緑、青の石
ユーザー chiho_miyako
提出日時 2015-04-19 12:17:07
言語 Java
(openjdk 23)
結果
AC  
実行時間 214 ms / 5,000 ms
コード長 644 bytes
コンパイル時間 2,416 ms
コンパイル使用メモリ 74,252 KB
実行使用メモリ 41,708 KB
最終ジャッジ日時 2024-06-24 06:48:08
合計ジャッジ時間 8,255 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner koko = new Scanner(System.in);
        int[] a = new int[3];
        for(int i=0; i<3; i++){
            a[i]=koko.nextInt();
        }
        Arrays.sort(a);
        int number=a[0];
        for(int i=0; i<3; i++){
            a[i]=a[i]-number;
        }
        while(a[2]>=3&&a[1]>=1){
            a[2]=a[2]-3;
            a[1]=a[1]-1;
            number++;
            Arrays.sort(a);
        }
        while(a[2]>=5){
            a[2]=a[2]-5;
            number++;
        }
        System.out.println(number);
    }
}
0