結果

問題 No.836 じょうよ
ユーザー m1025o1184t
提出日時 2019-10-12 20:01:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 121 ms / 1,000 ms
コード長 570 bytes
コンパイル時間 1,685 ms
コンパイル使用メモリ 167,856 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-29 02:33:09
合計ジャッジ時間 4,088 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

ll L, R, N;

ll countMultiple(ll R, ll div, ll mod) {
	if (R == 0) return 0;

	ll res = R / div;
	if (mod <= R % div and 0 < mod) res++;
	return res;
}
ll countMultiple(ll L, ll R, ll div, ll mod) {//[L,R] and x % div = mod
	return countMultiple(R, div, mod) - countMultiple(L - 1, div, mod);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> L >> R >> N;

	rep(i, N) cout << countMultiple(L, R, N, i) << endl;
}
0