結果
問題 |
No.161 制限ジャンケン
|
ユーザー |
|
提出日時 | 2015-06-29 16:46:05 |
言語 | Go (1.23.4) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,636 bytes |
コンパイル時間 | 11,226 ms |
コンパイル使用メモリ | 220,600 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-10 19:08:24 |
合計ジャッジ時間 | 12,285 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 16 |
ソースコード
package main import ( "bufio" "fmt" "math" "os" "strconv" ) func nextInt() int { i, e := strconv.Atoi(nextString()) if e != nil { panic(e) } return i } func nextFloat() float64 { f, e := strconv.ParseFloat(nextString(), 64) if e != nil { panic(e) } return f } func nextString() string { var sc = bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) sc.Scan() return sc.Text() } func main() { var G, C, P float64 fmt.Scan(&G) fmt.Scan(&C) fmt.Scan(&P) S := nextString() var G2, C2, P2 float64 for i := 0; i < len(S); i++ { if S[i] == 'G' { G2++ } else if S[i] == 'C' { C2++ } else { P2++ } } fmt.Printf("%v %v %v\n", G2, C2, P2) ans := 0.0 x := math.Min(G, C2) G -= x C2 -= x ans += x * 3 x = 0.0 x += math.Min(C, P2) C -= x P2 -= x ans += x * 3 x = 0.0 x += math.Min(P, G2) P -= x G2 -= x ans += x * 3 x = 0.0 x += math.Min(G, G2) G -= x G2 -= x ans += x x = 0.0 x += math.Min(C, C2) C -= x C2 -= x ans += x x = 0.0 x += math.Min(P, P2) P -= x P2 -= x ans += x x = 0.0 fmt.Println(ans) }