結果
問題 | No.35 タイパー高橋 |
ユーザー |
|
提出日時 | 2016-02-24 23:36:46 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 6 ms / 5,000 ms |
コード長 | 1,058 bytes |
コンパイル時間 | 11,392 ms |
コンパイル使用メモリ | 236,384 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 22:24:45 |
合計ジャッジ時間 | 11,892 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 |
ソースコード
package main import "fmt" import "bufio" import "os" type game struct { Time int Characters string } func loadGames(games int, sc *bufio.Scanner) []game { // 0-9で表す。 items := make([]game, 0) for i := 0;i < games; i++ { var time int var chars string sc.Scan() text := sc.Text() fmt.Sscanf(text, "%d %s", &time, &chars) items = append(items, game{time, chars}) } return items } func main() { var games int fmt.Scan(&games) sc := bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanLines) items := loadGames(games, sc) typed, untyped := solve(items) fmt.Println(typed, untyped) } const ( typePerSec = 12.0 ) func solve(games []game) (int, int) { result := 0 untyped := 0 // それぞれのアイテムについて、2で割った商だけパワーアップできる。 for _, v := range games { typed := int(float64(v.Time * typePerSec / 1000)) if typed >= len(v.Characters) { result += len(v.Characters) } else { result += typed untyped += len(v.Characters) - typed } } return result, untyped }