結果

問題 No.836 じょうよ
ユーザー OlandOland
提出日時 2019-06-14 22:02:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 158 ms / 1,000 ms
コード長 3,233 bytes
コンパイル時間 2,456 ms
コンパイル使用メモリ 76,388 KB
実行使用メモリ 55,616 KB
最終ジャッジ日時 2023-08-09 00:38:04
合計ジャッジ時間 8,025 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 151 ms
54,432 KB
testcase_01 AC 43 ms
49,388 KB
testcase_02 AC 44 ms
49,460 KB
testcase_03 AC 43 ms
49,776 KB
testcase_04 AC 44 ms
49,256 KB
testcase_05 AC 42 ms
49,620 KB
testcase_06 AC 42 ms
49,396 KB
testcase_07 AC 42 ms
49,384 KB
testcase_08 AC 43 ms
49,492 KB
testcase_09 AC 41 ms
49,408 KB
testcase_10 AC 41 ms
49,452 KB
testcase_11 AC 92 ms
51,836 KB
testcase_12 AC 94 ms
52,028 KB
testcase_13 AC 90 ms
52,120 KB
testcase_14 AC 54 ms
50,032 KB
testcase_15 AC 92 ms
49,476 KB
testcase_16 AC 158 ms
55,148 KB
testcase_17 AC 150 ms
54,228 KB
testcase_18 AC 92 ms
52,276 KB
testcase_19 AC 102 ms
52,448 KB
testcase_20 AC 136 ms
54,600 KB
testcase_21 AC 60 ms
50,056 KB
testcase_22 AC 116 ms
54,380 KB
testcase_23 AC 131 ms
55,616 KB
testcase_24 AC 87 ms
52,064 KB
testcase_25 AC 109 ms
52,772 KB
testcase_26 AC 54 ms
49,608 KB
testcase_27 AC 58 ms
50,400 KB
testcase_28 AC 88 ms
51,440 KB
testcase_29 AC 61 ms
50,732 KB
testcase_30 AC 56 ms
50,216 KB
testcase_31 AC 93 ms
52,156 KB
testcase_32 AC 93 ms
52,596 KB
testcase_33 AC 58 ms
50,256 KB
testcase_34 AC 89 ms
51,800 KB
testcase_35 AC 89 ms
52,240 KB
testcase_36 AC 115 ms
54,780 KB
testcase_37 AC 113 ms
54,376 KB
testcase_38 AC 129 ms
54,948 KB
testcase_39 AC 117 ms
54,408 KB
testcase_40 AC 142 ms
55,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.util.function.Function;
import java.util.stream.Collectors;

@SuppressWarnings("unused")
public class Main {
	String fileName = "input.txt";
	final boolean isDebug = false;
	//final boolean isDebug = true;
	FastScanner in = new FastScanner(System.in);
	PrintWriter out = new PrintWriter(System.out);
	final int MOD = (int)1e9+7;
	final long INF = Long.MAX_VALUE / 2;
	//final int INF = Integer.MAX_VALUE / 2;
	
	//System.out.println();はつかわない!!
	void solve() throws Exception{
		long L = in.nextLong(), R = in.nextLong();
		int N = in.nextInt();
		long[] num = new long[N];
		if(R - L + 1 <= N){
			for(long i = L; i <= R; i++) num[(int)(i % N)]++;
		}else{
			Arrays.fill(num, (R - L + 1) / N);
			long last = ((L % N) + N - 1) % N;
			for(long i = R; i >= L; i--){
				if(i % N == last) break;
				num[(int)(i % N)]++;
			}
		}
		for(int i = 0; i < N; i++) out.println(num[i]);
	}
	
	/* end solve */
	
	/* main */
	public static void main(String[] args) throws Exception {
		new Main().m();
	}
	
	void m() throws Exception {
		if(isDebug) in = new FastScanner(new FileInputStream(fileName));
		solve();
		out.flush();
	}
	/* end main */
}
/* end Main */

class FastScanner {
	Reader input;

	FastScanner() {this(System.in);}
	FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}
	
	int nextInt() {return (int) nextLong();}

	long nextLong() {
		try {
			int sign = 1;
			int b = input.read();
			while ((b < '0' || '9' < b) && b != '-' && b != '+') {
				b = input.read();
			}
			if (b == '-') {
				sign = -1;
				b = input.read();
			} else if (b == '+') {
				b = input.read();
			}
			long ret = b - '0';
			while (true) {
				b = input.read();
				if (b < '0' || '9' < b) return ret * sign;
				ret *= 10;
				ret += b - '0';
			}
		} catch (IOException e) {
			e.printStackTrace();
			return -1;
		}
	}

	double nextDouble() {
		try {
			double sign = 1;
			int b = input.read();
			while ((b < '0' || '9' < b) && b != '-' && b != '+') {
				b = input.read();
			}
			if (b == '-') {
				sign = -1;
				b = input.read();
			} else if (b == '+') {
				b = input.read();
			}
			double ret = b - '0';
			while (true) {
				b = input.read();
				if (b < '0' || '9' < b) break;
				ret *= 10;
				ret += b - '0';
			}
			if (b != '.') return sign * ret;
			double div = 1;
			b = input.read();
			while ('0' <= b && b <= '9') {
				ret *= 10;
				ret += b - '0';
				div *= 10;
				b = input.read();
			}
			return sign * ret / div;
		} catch (IOException e) {
			e.printStackTrace();
			return Double.NaN;
		}
	}

	char nextChar() {
		try {
			int b = input.read();
			while (Character.isWhitespace(b)) {
				b = input.read();
			}
			return (char) b;
		} catch (IOException e) {
			e.printStackTrace();
			return 0;
		}
	}

	String nextStr() {
		try {
			StringBuilder sb = new StringBuilder();
			int b = input.read();
			while (Character.isWhitespace(b)) {
				b = input.read();
			}
			while (b != -1 && !Character.isWhitespace(b)) {
				sb.append((char) b);
				b = input.read();
			}
			return sb.toString();
		} catch (IOException e) {
			e.printStackTrace();
			return "";
		}
	}
}
0