結果

問題 No.91 赤、緑、青の石
ユーザー ichyoichyo
提出日時 2014-12-07 19:27:24
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 654 bytes
コンパイル時間 13,308 ms
コンパイル使用メモリ 223,056 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 09:20:15
合計ジャッジ時間 12,017 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
5,248 KB
testcase_01 AC 11 ms
5,248 KB
testcase_02 AC 17 ms
5,376 KB
testcase_03 AC 15 ms
5,376 KB
testcase_04 AC 16 ms
5,376 KB
testcase_05 AC 14 ms
5,376 KB
testcase_06 WA -
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 17 ms
5,376 KB
testcase_12 AC 16 ms
5,376 KB
testcase_13 AC 12 ms
5,376 KB
testcase_14 AC 13 ms
5,376 KB
testcase_15 AC 19 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 18 ms
5,376 KB
testcase_26 AC 19 ms
5,376 KB
testcase_27 AC 22 ms
5,376 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 15 ms
5,376 KB
testcase_31 AC 17 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import "fmt"

func dec(r, g, b *int) bool {
	if *r >= *g && *r >= *b {
		if *r < 2 {
			return false
		}
		*r -= 2
	} else if *g >= *r && *g >= *b {
		if *g < 2 {
			return false
		}
		*g -= 2
	} else {
		if *b < 2 {
			return false
		}
		*b -= 2
	}
	return true
}

func main() {
	var r, g, b int
	fmt.Scan(&r, &g, &b)
	ans := 0
	for {
		need := 0
		if r > 0 {
			r--
		} else {
			need++
		}
		if g > 0 {
			g--
		} else {
			need++
		}
		if b > 0 {
			b--
		} else {
			need++
		}
		if need > 0 {
			if dec(&r, &g, &b) {
			} else {
				break
			}
		}
		ans++
	}
	fmt.Println(ans)
}
0