結果
問題 | No.428 小数から逃げる夢 |
ユーザー |
![]() |
提出日時 | 2016-10-02 22:29:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 797 bytes |
コンパイル時間 | 741 ms |
コンパイル使用メモリ | 80,364 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-21 13:14:16 |
合計ジャッジ時間 | 3,104 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 100 |
ソースコード
#include <iostream> #include <vector> #include <cstring> #include <string> #include <algorithm> #include <iomanip> #include <cmath> #include <cassert> using namespace std; typedef long long ll; string D = "0.1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991"; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; reverse(D.begin(), D.end()); string ans; ll c = 0; for(int i = 0; i < D.size(); i++) { if(D[i] == '.') { ans += '.'; continue; } c += (D[i] - '0') * N; ans += char('0' + c % 10); c /= 10; } while(c) { ans += '0' + c % 10; c /= 10; } reverse(ans.begin(), ans.end()); cout << ans << endl; }