結果
| 問題 |
No.1185 完全な3の倍数
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2020-08-22 13:10:24 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 499 bytes |
| コンパイル時間 | 2,600 ms |
| コンパイル使用メモリ | 192,992 KB |
| 最終ジャッジ日時 | 2025-01-13 07:15:40 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 2000000005
int N;
int ans = 0;
void dfs(long long n){
if(n>N)return;
if(n>=10)ans++;
for(int i=0;i<=9;i+=3){
if(n*10+i==n)continue;
dfs(n*10+i);
}
}
int main(){
cin>>N;
dfs(0);
vector<int> t = {12,15,18,42,45,48,72,75,78,21,24,27,51,54,57,81,84,87};
for(int i=0;i<t.size();i++){
if(t[i]<=N)ans++;
}
cout<<ans<<endl;
return 0;
}
沙耶花