結果
問題 |
No.1185 完全な3の倍数
|
ユーザー |
![]() |
提出日時 | 2020-08-22 13:33:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,084 ms / 2,000 ms |
コード長 | 501 bytes |
コンパイル時間 | 2,285 ms |
コンパイル使用メモリ | 191,696 KB |
最終ジャッジ日時 | 2025-01-13 07:42:59 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 |
ソースコード
#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include <bits/stdc++.h> using namespace std; int main() { ll n; cin>>n; if(n<100){ cout<<n/3-3<<endl; return 0; } ll ans=30; for(int i=102;i<=n;i+=3){ ll x=i; bool b=true; while(x>0){ if(x%10!=3 && x%10!=6 && x%10!=9 && x%10!=0){ b=false; break; } x/=10; } if(b) ans++; } cout<<ans<<endl; return 0; }