結果
問題 | No.836 じょうよ |
ユーザー | Oland |
提出日時 | 2019-06-14 22:02:35 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 164 ms / 1,000 ms |
コード長 | 3,233 bytes |
コンパイル時間 | 3,504 ms |
コンパイル使用メモリ | 80,984 KB |
実行使用メモリ | 56,236 KB |
最終ジャッジ日時 | 2024-11-14 05:53:54 |
合計ジャッジ時間 | 8,496 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 164 ms
55,688 KB |
testcase_01 | AC | 55 ms
50,052 KB |
testcase_02 | AC | 56 ms
50,272 KB |
testcase_03 | AC | 54 ms
50,500 KB |
testcase_04 | AC | 55 ms
50,456 KB |
testcase_05 | AC | 55 ms
50,476 KB |
testcase_06 | AC | 54 ms
50,064 KB |
testcase_07 | AC | 54 ms
50,040 KB |
testcase_08 | AC | 54 ms
50,008 KB |
testcase_09 | AC | 55 ms
50,232 KB |
testcase_10 | AC | 54 ms
50,416 KB |
testcase_11 | AC | 101 ms
51,836 KB |
testcase_12 | AC | 107 ms
51,816 KB |
testcase_13 | AC | 99 ms
51,416 KB |
testcase_14 | AC | 63 ms
50,152 KB |
testcase_15 | AC | 104 ms
51,948 KB |
testcase_16 | AC | 164 ms
55,680 KB |
testcase_17 | AC | 160 ms
55,060 KB |
testcase_18 | AC | 104 ms
51,560 KB |
testcase_19 | AC | 112 ms
51,792 KB |
testcase_20 | AC | 144 ms
54,188 KB |
testcase_21 | AC | 84 ms
50,948 KB |
testcase_22 | AC | 124 ms
54,672 KB |
testcase_23 | AC | 153 ms
55,476 KB |
testcase_24 | AC | 98 ms
51,244 KB |
testcase_25 | AC | 114 ms
51,848 KB |
testcase_26 | AC | 62 ms
50,364 KB |
testcase_27 | AC | 68 ms
51,024 KB |
testcase_28 | AC | 100 ms
51,756 KB |
testcase_29 | AC | 74 ms
51,016 KB |
testcase_30 | AC | 71 ms
50,364 KB |
testcase_31 | AC | 102 ms
52,036 KB |
testcase_32 | AC | 103 ms
51,896 KB |
testcase_33 | AC | 67 ms
50,924 KB |
testcase_34 | AC | 101 ms
51,800 KB |
testcase_35 | AC | 104 ms
52,068 KB |
testcase_36 | AC | 132 ms
54,596 KB |
testcase_37 | AC | 131 ms
54,628 KB |
testcase_38 | AC | 141 ms
56,236 KB |
testcase_39 | AC | 134 ms
54,644 KB |
testcase_40 | AC | 160 ms
56,236 KB |
ソースコード
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 ""; } } }