結果
| 問題 |
No.1185 完全な3の倍数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-22 13:13:48 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 815 bytes |
| コンパイル時間 | 903 ms |
| コンパイル使用メモリ | 90,280 KB |
| 最終ジャッジ日時 | 2025-01-13 07:19:19 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:19: error: variable ‘std::array<int, 4> v’ has initializer but incomplete type
23 | array<int, 4> v{0, 3, 6, 9};
| ^
ソースコード
#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;
}