結果

問題 No.1185 完全な3の倍数
ユーザー risujiroh
提出日時 2020-08-22 13:47:43
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 5,039 ms
コンパイル使用メモリ 246,732 KB
最終ジャッジ日時 2025-01-13 08:05:27
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/extc++.h>

#ifndef DUMP
#define DUMP(...) (void)0
#endif

using namespace std;

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int n;
  cin >> n;
  int res = 0;
  for (int bt = 0; bt < 1 << 18; ++bt) {
    string s;
    for (int i = 0; i < 9; ++i) s += "0369"[bt >> 2 * i & 3];
    int x = stoi(s);
    res += 100 <= x and x <= n;
  }
  for (int i = 10; i < 100; ++i)
    if (i % 3 == 0) res += i <= n;
  cout << res << '\n';
}
0