結果

問題 No.836 じょうよ
ユーザー ks2m
提出日時 2019-06-14 22:16:18
言語 Java
(openjdk 23)
結果
AC  
実行時間 236 ms / 1,000 ms
コード長 655 bytes
コンパイル時間 2,164 ms
コンパイル使用メモリ 74,524 KB
実行使用メモリ 57,884 KB
最終ジャッジ日時 2024-11-14 06:31:37
合計ジャッジ時間 10,485 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong() + 1;
		long n = sc.nextLong();
		sc.close();

		long a = l % n;
		long b = r % n;
		long c = (r - l) / n;
		PrintWriter pw = new PrintWriter(System.out);
		for (int i = 0; i < n; i++) {
			long ans = c;
			if (a < b) {
				if (i >= a) {
					ans++;
				}
				if (i >= b) {
					ans--;
				}
			}
			if (b < a) {
				if (i < b) {
					ans++;
				}
				if (a <= i) {
					ans++;
				}
			}
			pw.println(ans);
		}
		pw.flush();
	}
}
0