結果

問題 No.428 小数から逃げる夢
ユーザー kurenai3110
提出日時 2016-10-02 23:29:59
言語 C++11
(gcc 4.8.5)
結果
AC  
実行時間 5 ms
コード長 889 Byte
コンパイル時間 344 ms
使用メモリ 1,520 KB
最終ジャッジ日時 2019-07-13 10:10:39

テストケース

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

ソースコード

diff #
#include <iostream>
#include <string>
#include <iomanip>
#include <vector>
using namespace std;
int ans[200];
int main()
{
	string D = "1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991";


	int n; cin >> n;
	for (int i = D.size()-1; i >= 0; i--) {
		int d = D[i] - '0';

		d *= n;
		int a=d%10, b=d%100/10, c=d%1000/100;
		//cout << a << b << c << endl;
		ans[i+2] += a;
		if (ans[i + 2] >= 10) {
			ans[i + 1] += ans[i + 2]/10;
			ans[i + 2] %= 10;
		}
		ans[i+1] += b;
		if (ans[i + 1] >= 10) {
			ans[i] += ans[i + 1] / 10;
			ans[i + 1] %= 10;
		}
		ans[i] += c;
	}

	bool first = true;
	for (int i = 0; i <= D.size()+1; i++){
		if (i == 0 && ans[i] == 0)continue;
		if (i == 2)cout << '.';
		cout << ans[i];
	}
	cout << endl;
    return 0;
}
0