結果
| 問題 | 
                            No.836 じょうよ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-09-01 12:43:15 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 114 ms / 1,000 ms | 
| コード長 | 569 bytes | 
| コンパイル時間 | 636 ms | 
| コンパイル使用メモリ | 73,812 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-27 21:26:51 | 
| 合計ジャッジ時間 | 3,118 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 41 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long int ll;
ll cnt[100010];
int main(){
	ll l,r,n; cin >> l >> r >> n;
	ll left=l/n; ll right=r/n;
	ll c=0;
	if(left==right){
		for(ll i=l;i<=r;i++){
			cnt[i%n]++;
		}
		for(int i=0;i<n;i++){
			cout << cnt[i] << endl;
		}
		return 0;
	}
	if(right-left>1)c+=(right-left-1);
	for(ll i=l;;i++){
		if(i!=l&&i%n==0)break;
		cnt[i%n]++;
	}
	for(ll i=r;;i--){
		if(i!=r&&i%n==n-1)break;
		cnt[i%n]++;
	}
	for(int i=0;i<n;i++){
		cout << cnt[i]+c << endl;
	}
}