結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー yukirinyukirin
提出日時 2016-02-26 19:48:18
言語 Go
(1.22.1)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 594 bytes
コンパイル時間 14,274 ms
コンパイル使用メモリ 209,668 KB
実行使用メモリ 24,408 KB
平均クエリ数 3.40
最終ジャッジ日時 2023-09-23 08:59:40
合計ジャッジ時間 15,691 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
23,676 KB
testcase_01 AC 43 ms
23,652 KB
testcase_02 WA -
testcase_03 AC 45 ms
23,664 KB
testcase_04 AC 42 ms
23,844 KB
testcase_05 AC 42 ms
23,640 KB
testcase_06 AC 42 ms
23,424 KB
testcase_07 AC 41 ms
23,832 KB
testcase_08 AC 42 ms
23,844 KB
testcase_09 WA -
testcase_10 AC 43 ms
23,856 KB
testcase_11 AC 43 ms
23,844 KB
testcase_12 AC 42 ms
23,400 KB
testcase_13 AC 42 ms
23,544 KB
testcase_14 AC 43 ms
24,036 KB
testcase_15 AC 44 ms
24,048 KB
testcase_16 AC 43 ms
24,408 KB
testcase_17 AC 42 ms
23,664 KB
testcase_18 WA -
testcase_19 AC 43 ms
23,424 KB
testcase_20 AC 42 ms
23,436 KB
testcase_21 AC 42 ms
23,652 KB
testcase_22 AC 42 ms
23,556 KB
testcase_23 AC 43 ms
24,396 KB
testcase_24 AC 41 ms
23,676 KB
testcase_25 AC 43 ms
23,544 KB
testcase_26 AC 44 ms
23,400 KB
testcase_27 AC 42 ms
23,568 KB
testcase_28 AC 43 ms
23,544 KB
testcase_29 AC 44 ms
23,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func main() {
	sc.Split(bufio.ScanWords)
	n, k := nextInt(), nextInt()

	mod := 0
	if !(k >= n || n%(k+1) != 1) {
		fmt.Println(0)
	} else {
		mod = n%(k+1) - 1
		fmt.Println(mod)
	}

	for {
		os.Stdout.Sync()
		ans := nextInt()
		if ans >= n {
			return
		}
		m := (ans - mod) % (k + 1)
		fmt.Println(ans + k + 1 - m)
	}
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextLine())
	return i
}
0