結果

問題 No.3240 Count 8 Included Numbers (Easy)
ユーザー Tehom
提出日時 2025-08-22 23:36:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 3,717 ms
コンパイル使用メモリ 251,344 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-22 23:37:19
合計ジャッジ時間 4,690 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repl(i,a,b) for(ll i=(a);i<(b);i++)
#define all(a) (a).begin(),(a).end()

template <typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;} return false;}
template <typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;} return false;}

int f(int m){
  int res=0;
  rep(i,1,m+1){
    int x=i;
    while(x>0){
      if(x%10 == 8){
        res++;
        break;
      }
      x/=10;
    }
  }
  return res;
}

int main(){
  int n; cin >> n;
  cout << f(n) << endl;
}
0