結果

問題 No.836 じょうよ
ユーザー yyyy52yyyy52
提出日時 2019-06-14 22:35:18
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 735 bytes
コンパイル時間 1,356 ms
コンパイル使用メモリ 160,148 KB
実行使用メモリ 13,760 KB
最終ジャッジ日時 2024-04-26 17:33:03
合計ジャッジ時間 6,776 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:34:13: warning: ‘temp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   34 |     for(int i=temp;i>=b;i--)
      |             ^

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
using namespace std;

/* int main()
{
    int64_t a,b,n;
    cin>>a>>b>>n;
    vector<int64_t>s(n,((b-b%n)-(a-a%n))/n);
    for (int64_t i=min(a%n,b%n);i<=max(a%n,b%n);i++) s[i]++;
    REP(i,n)cout<<s[i]<<endl;
}*/

int main()
{
    int64_t a,b,n,temp,sum=0;
    cin>>a>>b>>n;   
    vector<int64_t>s(n);
    for(int i=a;i<=b;i++)
    {
        s[i]++;
        if(i%n==0)
        {
            s[i]--;
            while(i<b)
            {
                i+=n;
                sum++;
            }
            temp=i;
        }
    } 
    for(int i=temp;i>=b;i--)
    {
        s[i]--;
    }
    REP(i,n)cout<<s[i]+sum<<endl;
}
0