結果
問題 | No.1185 完全な3の倍数 |
ユーザー | hiragn |
提出日時 | 2020-08-24 03:11:53 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 79 ms / 2,000 ms |
コード長 | 504 bytes |
コンパイル時間 | 2,107 ms |
コンパイル使用メモリ | 204,524 KB |
実行使用メモリ | 15,744 KB |
最終ジャッジ日時 | 2024-05-03 10:27:39 |
合計ジャッジ時間 | 4,239 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 69 ms
14,208 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 67 ms
13,312 KB |
testcase_04 | AC | 78 ms
14,976 KB |
testcase_05 | AC | 69 ms
14,208 KB |
testcase_06 | AC | 65 ms
13,568 KB |
testcase_07 | AC | 65 ms
13,440 KB |
testcase_08 | AC | 79 ms
15,744 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 1 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 1 ms
5,376 KB |
testcase_14 | AC | 1 ms
5,376 KB |
testcase_15 | AC | 2 ms
5,376 KB |
testcase_16 | AC | 1 ms
5,376 KB |
testcase_17 | AC | 1 ms
5,376 KB |
testcase_18 | AC | 2 ms
5,376 KB |
testcase_19 | AC | 22 ms
6,528 KB |
testcase_20 | AC | 60 ms
12,672 KB |
testcase_21 | AC | 41 ms
9,472 KB |
testcase_22 | AC | 24 ms
7,424 KB |
testcase_23 | AC | 21 ms
6,528 KB |
testcase_24 | AC | 60 ms
12,672 KB |
testcase_25 | AC | 7 ms
5,376 KB |
testcase_26 | AC | 42 ms
9,600 KB |
testcase_27 | AC | 24 ms
6,528 KB |
testcase_28 | AC | 44 ms
9,984 KB |
testcase_29 | AC | 37 ms
8,832 KB |
testcase_30 | AC | 43 ms
9,600 KB |
testcase_31 | AC | 2 ms
5,376 KB |
testcase_32 | AC | 71 ms
14,336 KB |
testcase_33 | AC | 15 ms
5,632 KB |
testcase_34 | AC | 58 ms
12,672 KB |
testcase_35 | AC | 76 ms
14,976 KB |
testcase_36 | AC | 60 ms
12,672 KB |
testcase_37 | AC | 61 ms
12,672 KB |
testcase_38 | AC | 42 ms
9,600 KB |
testcase_39 | AC | 2 ms
5,376 KB |
testcase_40 | AC | 2 ms
5,376 KB |
testcase_41 | AC | 2 ms
5,376 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; int n; set<int> st; void dfs(int i, int cur) { if (i == 10 or cur > n) return; if (cur > 100) st.insert(cur); dfs(i + 1, cur * 10); dfs(i + 1, cur * 10 + 3); dfs(i + 1, cur * 10 + 6); dfs(i + 1, cur * 10 + 9); } int main() { cin >> n; // 2桁の場合 for (int i = 12; i < 100 and i <= n; i += 3) { st.insert(i); } // 3桁以上の場合 dfs(0, 0); cout << st.size() << endl; return 0; }