結果

問題 No.207 世界のなんとか
ユーザー gamenerdDAI
提出日時 2018-08-29 00:21:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 488 bytes
コンパイル時間 1,140 ms
コンパイル使用メモリ 159,388 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 12:23:43
合計ジャッジ時間 1,914 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

bool nabeatsu (int n);
bool have3 (int n);

int main () {

    int a, b;
    cin >> a >> b;

    for (int i = a; i <= b; i++) {
        if (nabeatsu(i)) {
            cout << i << endl;
        }
    }

    return 0;
}

bool nabeatsu (int n) {

    if (n % 3 == 0 || have3(n)) return true;
    else return false;
}

bool have3 (int n) {

    while (n > 0) {
        if (n % 10 == 3) return true;

        n /= 10;
    }

    return false;
}
0