結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n" 
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;cin>>n;
    int m = n;
    int x = m%10;
    m/=10;
    int y = m%10;
    m/=10;
    int z = m%10;
    int ans = 19*z;
    if(z<8){
        if(y<8){
            ans += y;
            if(x>=8)ans++;
        }else{
            if(y==8){
                ans += y;
                ans += x+1;
            }else if(y==9){
                if(x<8)ans += 18;
                else ans += 19;
            }
        }
    }else{
        ans += (10*y+x+1);
    }
    cout<<ans;
    return 0;
}
0