結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
Kgm1500
|
| 提出日時 | 2017-03-04 11:23:36 |
| 言語 | Go (1.25.7) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 623 bytes |
| 記録 | |
| コンパイル時間 | 25,859 ms |
| コンパイル使用メモリ | 290,296 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-03-07 12:21:11 |
| 合計ジャッジ時間 | 18,413 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 WA * 24 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
"strings"
)
func getIntList(sc *bufio.Scanner) []int {
sc.Scan()
input := strings.Split(sc.Text(), " ")
result := make([]int, len(input))
for i, v := range input {
if j, e := strconv.Atoi(v); e != nil {
panic(e)
} else {
result[i] = j
}
}
return result
}
func main() {
var l, n int
fmt.Scan(&l, &n)
sc := bufio.NewScanner(os.Stdin)
wList := getIntList(sc)
sort.Ints(wList)
boxesNum := 0
for boxesWidth := 0; ; {
if boxesNum < n && boxesWidth+wList[boxesNum] <= l {
boxesNum++
} else {
break
}
}
fmt.Print(boxesNum)
}
Kgm1500