結果

問題 No.3240 Count 8 Included Numbers (Easy)
ユーザー AngrySadEight
提出日時 2025-05-18 03:24:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 69,244 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-22 20:30:04
合計ジャッジ時間 1,180 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

bool is_include_8(string &s) {
    bool ret = false;
    for (char x : s) {
        if (x == '8') {
            ret = true;
        }
    }
    return ret;
}

int main() {
    int N;
    cin >> N;

    int ans = 0;
    for (int i = 1; i <= N; i++) {
        string si = to_string(i);
        if (is_include_8(si)) {
            ans++;
        }
    }
    cout << ans << endl;
}
0