結果

問題 No.207 世界のなんとか
ユーザー kdaiki211
提出日時 2017-01-08 22:56:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 544 bytes
コンパイル時間 444 ms
コンパイル使用メモリ 55,152 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-17 22:58:22
合計ジャッジ時間 1,236 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdint.h>
#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

bool check(const uint32_t val)
{
    if (val % 3 == 0) return true;

    char n_s[11];
    sprintf(n_s, "%u", val);

    const uint32_t len = strlen(n_s);
    for (int i = 0; i < len; i++) {
        if (n_s[i] == '3') return true;
    }

    return false;
}

int main(void)
{
    uint32_t A, B;
    cin >> A >> B;
    for (uint32_t i = A; i <= B; i++) {
        if (check(i)) {
            cout << i << endl;
        }
    }
    return 0;
}

0