結果
問題 | No.836 じょうよ |
ユーザー |
|
提出日時 | 2019-06-29 11:50:55 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 256 ms / 1,000 ms |
コード長 | 795 bytes |
コンパイル時間 | 3,453 ms |
コンパイル使用メモリ | 75,104 KB |
実行使用メモリ | 46,764 KB |
最終ジャッジ日時 | 2024-07-02 05:29:49 |
合計ジャッジ時間 | 12,581 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 41 |
ソースコード
import java.io.*; import java.util.Scanner; public class Main_yukicoder836 { private static Scanner sc; private static Printer pr; private static void solve() { long l = sc.nextLong(); long r = sc.nextLong(); int n = sc.nextInt(); for (int i = 0; i < n; i++) { pr.println(f(r, n, i) - f(l - 1, n, i)); } } private static long f(long l, int n, int i) { long ret = l / n; if (i == 0) { return ret; } else { return ret + (l % n >= i ? 1 : 0); } } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } static class Printer extends PrintWriter { Printer(OutputStream out) { super(out); } } }