結果
| 問題 |
No.1849 Three Times Value
|
| ユーザー |
|
| 提出日時 | 2022-06-09 19:41:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 833 bytes |
| コンパイル時間 | 587 ms |
| コンパイル使用メモリ | 74,068 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-21 05:37:53 |
| 合計ジャッジ時間 | 1,763 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:34:11: warning: 'll_plus' may be used uninitialized [-Wmaybe-uninitialized]
34 | ev+=ll_plus;
| ~~^~~~~~~~~
main.cpp:20:14: note: 'll_plus' was declared here
20 | lint ev, ll_plus;
| ^~~~~~~
main.cpp:24:18: warning: 'ev' may be used uninitialized [-Wmaybe-uninitialized]
24 | if(ev%10==9){
| ~~^~~
main.cpp:20:10: note: 'ev' was declared here
20 | lint ev, ll_plus;
| ^~
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#define rep(i,n) for(i=0; i<n; ++i)
#define in(a) cin >> a
#define out(a,b) cout << a << b
using namespace std;
using lint = long long;
int main(void){
int i, j;
int n, m;
int cnt = 0, ans = 0;
lint N;
in(N);
lint ev, ll_plus;
int pl_cnt=8, a=0;
while(1){
if(cnt%pl_cnt==0){
if(ev%10==9){
pl_cnt=10*pl_cnt+9;
cnt=0;
}
ev=1*pow(10,a)+10*pow(10,2*a)+100*pow(10,3*a);
ll_plus=1+pow(10,a+1)+pow(10,2*(a+1));
a++;
if(N<ev) break;
ans++;
}
ev+=ll_plus;
cnt++;
if(N<ev) break;
ans++;
}
cout << ans << endl;
return 0;
}