結果
問題 | No.46 はじめのn歩 |
ユーザー |
|
提出日時 | 2018-02-27 23:09:51 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 561 bytes |
コンパイル時間 | 11,720 ms |
コンパイル使用メモリ | 220,160 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-30 21:01:06 |
合計ジャッジ時間 | 12,391 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
package main import ( "bufio" "fmt" "math" "os" "strconv" "strings" ) func main() { in := bufio.NewScanner(os.Stdin) // 暗号化文字列 in.Scan() inText := in.Text() fmt.Println(stepCount(inText)) } // 歩数を数える。 func stepCount(input string) string { sp := strings.Split(input, " ") // stringをintに変換 m, _ := strconv.Atoi(sp[0]) s, _ := strconv.Atoi(sp[1]) // 小数が欲しいためfloatに変換して計算 step := float64(s) / float64(m) // 小数を切り上げ return strconv.Itoa(int(math.Ceil(step))) }