結果
問題 | No.428 小数から逃げる夢 |
ユーザー |
|
提出日時 | 2016-10-04 23:25:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,113 bytes |
コンパイル時間 | 975 ms |
コンパイル使用メモリ | 104,320 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-21 16:59:13 |
合計ジャッジ時間 | 3,339 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 100 |
ソースコード
#define _USE_MATH_DEFINES #include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> using namespace std; int main() { const string d = "1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991"; int len = d.size(); int n; cin >> n; string ans; int x = 0; for(int i=0; i<len; ++i){ x += (d[len-1-i] - '0') * n; ans += x % 10 + '0'; x /= 10; } reverse(ans.begin(), ans.end()); ans = to_string(x) + ans; if(ans.size() == len) ans = "0." + ans; else ans = ans.substr(0, ans.size() - len) + '.' + ans.substr(ans.size() - len); cout << ans << endl; return 0; }