結果

問題 No.428 小数から逃げる夢
ユーザー airis
提出日時 2016-10-02 22:57:38
言語 C++11
(gcc 4.8.5)
結果
AC  
実行時間 4 ms
コード長 1,442 Byte
コンパイル時間 940 ms
使用メモリ 3,488 KB
最終ジャッジ日時 2020-01-01 07:42:47

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
in001txt AC 0 ms
3,200 KB
in002txt AC 0 ms
3,288 KB
in003txt AC 4 ms
3,352 KB
in004txt AC 0 ms
3,300 KB
in005txt AC 4 ms
3,472 KB
in006txt AC 4 ms
3,216 KB
in007txt AC 0 ms
3,324 KB
in008txt AC 4 ms
3,332 KB
in009txt AC 4 ms
3,332 KB
in010txt AC 0 ms
3,220 KB
in011txt AC 4 ms
3,196 KB
in012txt AC 0 ms
3,196 KB
in013txt AC 0 ms
3,216 KB
in014txt AC 4 ms
3,336 KB
in015txt AC 0 ms
3,272 KB
in016txt AC 4 ms
3,484 KB
in017txt AC 4 ms
3,316 KB
in018txt AC 0 ms
3,320 KB
in019txt AC 4 ms
3,468 KB
in020txt AC 4 ms
3,328 KB
in021txt AC 0 ms
3,288 KB
in022txt AC 0 ms
3,272 KB
in023txt AC 4 ms
3,300 KB
in024txt AC 0 ms
3,296 KB
in025txt AC 4 ms
3,284 KB
in026txt AC 0 ms
3,272 KB
in027txt AC 4 ms
3,276 KB
in028txt AC 0 ms
3,472 KB
in029txt AC 4 ms
3,336 KB
in030txt AC 0 ms
3,320 KB
in031txt AC 4 ms
3,324 KB
in032txt AC 0 ms
3,348 KB
in033txt AC 4 ms
3,288 KB
in034txt AC 0 ms
3,300 KB
in035txt AC 4 ms
3,284 KB
in036txt AC 0 ms
3,468 KB
in037txt AC 0 ms
3,332 KB
in038txt AC 0 ms
3,296 KB
in039txt AC 0 ms
3,348 KB
in040txt AC 0 ms
3,340 KB
in041txt AC 0 ms
3,284 KB
in042txt AC 0 ms
3,336 KB
in043txt AC 4 ms
3,340 KB
in044txt AC 0 ms
3,300 KB
in045txt AC 0 ms
3,332 KB
in046txt AC 4 ms
3,296 KB
in047txt AC 0 ms
3,296 KB
in048txt AC 4 ms
3,320 KB
in049txt AC 0 ms
3,272 KB
in050txt AC 4 ms
3,348 KB
in051txt AC 0 ms
3,336 KB
in052txt AC 4 ms
3,272 KB
in053txt AC 0 ms
3,484 KB
in054txt AC 4 ms
3,320 KB
in055txt AC 0 ms
3,468 KB
in056txt AC 0 ms
3,336 KB
in057txt AC 4 ms
3,468 KB
in058txt AC 0 ms
3,220 KB
in059txt AC 4 ms
3,280 KB
in060txt AC 0 ms
3,324 KB
in061txt AC 4 ms
3,304 KB
in062txt AC 0 ms
3,324 KB
in063txt AC 4 ms
3,336 KB
in064txt AC 0 ms
3,348 KB
in065txt AC 4 ms
3,280 KB
in066txt AC 0 ms
3,276 KB
in067txt AC 4 ms
3,488 KB
in068txt AC 0 ms
3,280 KB
in069txt AC 4 ms
3,276 KB
in070txt AC 0 ms
3,284 KB
in071txt AC 0 ms
3,468 KB
in072txt AC 4 ms
3,296 KB
in073txt AC 0 ms
3,324 KB
in074txt AC 4 ms
3,336 KB
in075txt AC 0 ms
3,332 KB
in076txt AC 0 ms
3,328 KB
in077txt AC 4 ms
3,288 KB
in078txt AC 0 ms
3,284 KB
in079txt AC 4 ms
3,272 KB
in080txt AC 0 ms
3,288 KB
in081txt AC 4 ms
3,300 KB
in082txt AC 0 ms
3,324 KB
in083txt AC 4 ms
3,276 KB
in084txt AC 0 ms
3,484 KB
in085txt AC 4 ms
3,332 KB
in086txt AC 0 ms
3,296 KB
in087txt AC 0 ms
3,488 KB
in088txt AC 4 ms
3,488 KB
in089txt AC 0 ms
3,332 KB
in090txt AC 0 ms
3,340 KB
in091txt AC 4 ms
3,280 KB
in092txt AC 4 ms
3,288 KB
in093txt AC 4 ms
3,348 KB
in094txt AC 0 ms
3,276 KB
in095txt AC 0 ms
3,216 KB
in096txt AC 0 ms
3,488 KB
in097txt AC 0 ms
3,216 KB
in098txt AC 0 ms
3,328 KB
in099txt AC 0 ms
3,340 KB
in100txt AC 0 ms
3,300 KB
テストケース一括ダウンロード

ソースコード

diff #
#include <bits/stdc++.h>
#define rep(x, to) for (int x = 0; x < (to); x++)
#define REP(x, a, to) for (int x = (a); x < (to); x++)
#define EPS (1e-14)
#define _PA(x,N) rep(i,N){cout<<x[i]<<" ";}cout<<endl;
#define _PA2(x,H,W) rep(i,(H)){rep(j,(W)){cout<<x[i][j]<<" ";}cout<<endl;}

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef complex<double> Complex;
typedef vector< vector<int> > Mat;

int n;
int size;

char base[1005];
char ans[1005];

string s = "0.1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991";


// dst += src
void add(char *dst, char *src) {
	int p = 0, q = 0;
	for (int i = 0; i < size; i++) {
		if (dst[i] == '.') continue;
		int dst_x = dst[i] - '0';
		int src_x = src[i] - '0';
		q = (dst_x + src_x + p) % 10;
		p = (dst_x + src_x + p) / 10;
		dst[i] = '0' + q;

		if (i == size - 1 && p != 0) {
			dst[size] = '0';
			src[size] = '0';
			size++;
		}
	}
}

void solve() {

	size = s.size();
	for (int i = 0; i < size; i++) {
		base[i] = s[size - 1 - i];
		if (base[i] == '.') {
			ans[i] = '.';
		} else {
			ans[i] = '0';
		}
	}

	for (int i = 0; i < n; i++) {
		add(ans, base);
	}

	for (int i = 0; i < size; i++) {
		printf("%c", ans[size - 1 - i]);
	}
	printf("\n");

}

int main() {
	cin >> n;
	solve();
	return 0;
}


0