結果
| 問題 |
No.428 小数から逃げる夢
|
| コンテスト | |
| ユーザー |
kurenai3110
|
| 提出日時 | 2016-10-02 23:29:59 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 889 bytes |
| コンパイル時間 | 637 ms |
| コンパイル使用メモリ | 65,888 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-21 14:42:22 |
| 合計ジャッジ時間 | 2,586 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 100 |
ソースコード
#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;
}
kurenai3110