結果

問題 No.682 Average
ユーザー 👑 rin204
提出日時 2020-07-01 14:03:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 240 bytes
コンパイル時間 514 ms
コンパイル使用メモリ 63,744 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-13 22:59:34
合計ジャッジ時間 1,203 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:11:13: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   11 |     cout << ans << endl;
      |             ^~~
main.cpp:4:15: note: 'ans' was declared here
    4 |     int a, b, ans;
      |               ^~~

ソースコード

diff #

#include <iostream>
using namespace std;
int main(void){
    int a, b, ans;
    cin >> a >> b;
    for (int i = a; i <= b; i++){
        if ((i + a + b) % 3 == 0){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}
0