結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー uafr_cs
提出日時 2015-07-31 22:42:57
言語 Java
(openjdk 23)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 662 bytes
コンパイル時間 2,264 ms
コンパイル使用メモリ 74,500 KB
実行使用メモリ 70,680 KB
平均クエリ数 3.70
最終ジャッジ日時 2024-07-16 20:54:55
合計ジャッジ時間 8,666 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		final int K = sc.nextInt();
		
		
		final boolean take_first = N % (K + 1) != 1;
		for(int count = 0; count < N; ){
			// own
			if(count == 0 && !take_first){
				System.out.println(0);
			}else{
				final int next = (N - 1) - (((N - 1) - count) / (K + 1) * (K + 1));
				count = next;
				System.out.println(next);
			}
			
			//
			final int B = sc.nextInt();
			count = B;
		}
		
		
		
	}
	
}
0