結果

問題 No.1185 完全な3の倍数
ユーザー firiexpfiriexp
提出日時 2020-08-22 13:13:48
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 815 bytes
コンパイル時間 812 ms
コンパイル使用メモリ 90,764 KB
最終ジャッジ日時 2023-08-15 23:42:07
合計ジャッジ時間 1,396 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:23:19: エラー: variable ‘std::array<int, 4> v’ has initializer but incomplete type
   23 |     array<int, 4> v{0, 3, 6, 9};
      |                   ^

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    int ans = 0;
    array<int, 4> v{0, 3, 6, 9};
    for (int i = 12; i <= min(99, n); i += 3) {
        ans++;
    }
    for (int i = 0; i < (1 << 18); ++i) {
        int val = 0;
        int x = 1;
        for (int j = 0; j < 9; ++j) {
            val += v[(3 << (2*j) & i) >> (2*j)]*x;
            x *= 10;
        }
        if(val <= n && val >= 100) ans++;
    }
    cout << ans << "\n";
    return 0;
}
0