結果
問題 | No.63 ポッキーゲーム |
ユーザー |
|
提出日時 | 2018-03-10 21:10:39 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 712 bytes |
コンパイル時間 | 11,891 ms |
コンパイル使用メモリ | 226,344 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-14 17:56:37 |
合計ジャッジ時間 | 12,313 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
package mainimport ("bufio""fmt""os""strconv""strings")// エントリポイントfunc main() {in := bufio.NewScanner(os.Stdin)// ポッキーの長さと、1回にかじるポッキーの長さin.Scan()input1 := in.Text()fmt.Println(pocky(input1))}func pocky(str string) string {sp := strings.Split(str, " ")// ポッキーの長さpockyLength, _ := strconv.Atoi(sp[0])// 1回に齧るポッキーの長さgnawLength, _ := strconv.Atoi(sp[1])res := pockyLength / (gnawLength * 2)if pockyLength % (gnawLength * 2) == 0 && res != 0 {// ちょうど割り切れた場合はかじるのをやめるため、-1res--}res *= gnawLengthreturn strconv.Itoa(res)}