結果

問題 No.428 小数から逃げる夢
ユーザー forest3
提出日時 2025-03-25 16:53:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 734 bytes
コンパイル時間 1,756 ms
コンパイル使用メモリ 165,356 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-25 16:54:02
合計ジャッジ時間 5,352 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)

int main() {
	string s("1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991");
	int sz = s.size(), w = 0, n;
	cin >> n;
	vector<int> v(sz), r;
	for(int i = sz - 1; i >= 0; i--) {
		int x = s[i] - '0';
		int m = w % 10;
		w /= 10;
		int d = x * n + m;
		v[i] = d % 10;
		w += d /= 10;
	}
	while(w) {
		r.push_back(w % 10);
		w /= 10;
	}
	reverse(r.begin(), r.end());
	if(r.size()) for(int e : r) cout << e;
	else cout << 0;
	cout << '.';
	rep(i, sz) cout << v[i];
	cout << endl;
}
0