結果
| 問題 | 
                            No.1185 完全な3の倍数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             penguinman
                         | 
                    
| 提出日時 | 2020-07-31 01:43:32 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 489 bytes | 
| コンパイル時間 | 1,505 ms | 
| コンパイル使用メモリ | 166,288 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-24 09:03:22 | 
| 合計ジャッジ時間 | 2,752 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 39 | 
ソースコード
#include<bits/stdc++.h>
using ll=long long;
using std::cin;
using std::cout;
using std::vector;
using std::endl;
int main(){
    int N; cin>>N;
    const int max=1e9;
    assert(10<=N&&N<=max);
    int ans=0;
    for(int i=10;i<=100;i++){
        if(i%3==0&&i<=N) ans++;
    }
    for(int i=0;i<(1<<18);i++){
        int memo=0,X=i;
        for(int j=0;j<9;j++){
            memo=memo*10+X%4*3;
            X/=4;
        }
        if(memo<=N&&memo>=100) ans++;
    }
    cout<<ans<<endl;
}
            
            
            
        
            
penguinman