結果
問題 |
No.1849 Three Times Value
|
ユーザー |
|
提出日時 | 2025-03-14 02:11:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 497 bytes |
コンパイル時間 | 2,344 ms |
コンパイル使用メモリ | 192,392 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-14 02:11:41 |
合計ジャッジ時間 | 3,614 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include<bits/stdc++.h> #define int long long #define matsuri pair<int,int> //const int iris = 1e9+7; const int iris = 998244353; using namespace std; void solve() { int n; cin>>n; int l=1, r=1e5; auto cal=[](int a) { int d=1; while(d<=a) d*=10; return a*d*d+a*d+a; }; while(l<r) { int m=l+(r-l)/2; if(cal(m)>n) r=m; else l=m+1; } cout<<r-1<<'\n'; } signed main() { ios::sync_with_stdio(0); cin.tie(0); int T=1; //cin>>T; while(T--) solve(); return 0; }