結果
問題 |
No.428 小数から逃げる夢
|
ユーザー |
![]() |
提出日時 | 2020-03-19 12:37:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 1,000 bytes |
コンパイル時間 | 2,636 ms |
コンパイル使用メモリ | 197,068 KB |
最終ジャッジ日時 | 2025-01-09 07:51:59 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 100 |
ソースコード
#include<bits/stdc++.h> using lint=long long; int main(){ std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false); std::cout.setf(std::ios_base::fixed);std::cout.precision(15); std::string s="1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991"; lint n=s.length(); std::vector<lint>a; for(char c:std::string(s.rbegin(),s.rend())){ a.push_back(c-'0'); } lint d;std::cin>>d; lint carry=0; for(lint i=0;i<n;i++){ a.at(i)=a.at(i)*d+carry; carry=a.at(i)/10; a.at(i)%=10; } for(;carry;carry/=10){ a.push_back(carry%10); } std::reverse(a.begin(),a.end()); s.clear(); std::transform(a.begin(),a.end(),std::back_inserter(s),[](lint x){return '0'+x;}); s.insert(s.end()-n,'.'); if((lint)s.length()==n+1)s.insert(s.begin(),'0'); std::cout<<s<<'\n'; }