結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー yukirinyukirin
提出日時 2016-02-26 19:50:16
言語 Go
(1.22.1)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 626 bytes
コンパイル時間 11,652 ms
コンパイル使用メモリ 212,212 KB
実行使用メモリ 24,180 KB
平均クエリ数 3.70
最終ジャッジ日時 2023-09-23 23:15:51
合計ジャッジ時間 13,012 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
24,156 KB
testcase_01 AC 35 ms
23,544 KB
testcase_02 AC 35 ms
24,180 KB
testcase_03 AC 35 ms
23,664 KB
testcase_04 AC 35 ms
24,132 KB
testcase_05 AC 34 ms
23,616 KB
testcase_06 AC 34 ms
23,820 KB
testcase_07 AC 35 ms
23,652 KB
testcase_08 AC 34 ms
23,364 KB
testcase_09 AC 36 ms
23,244 KB
testcase_10 AC 38 ms
23,232 KB
testcase_11 AC 37 ms
23,208 KB
testcase_12 AC 35 ms
23,976 KB
testcase_13 AC 36 ms
23,964 KB
testcase_14 AC 35 ms
23,484 KB
testcase_15 AC 35 ms
24,180 KB
testcase_16 AC 34 ms
23,364 KB
testcase_17 AC 35 ms
23,352 KB
testcase_18 AC 36 ms
23,412 KB
testcase_19 AC 34 ms
23,664 KB
testcase_20 AC 35 ms
23,220 KB
testcase_21 AC 34 ms
24,012 KB
testcase_22 AC 34 ms
23,520 KB
testcase_23 AC 35 ms
24,084 KB
testcase_24 AC 35 ms
24,168 KB
testcase_25 AC 37 ms
23,376 KB
testcase_26 AC 37 ms
23,412 KB
testcase_27 AC 36 ms
23,256 KB
testcase_28 AC 35 ms
23,208 KB
testcase_29 AC 36 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
		if mod == -1 {
			mod = k
		}
		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