結果
| 問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-11-28 01:17:54 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 985 bytes |
| コンパイル時間 | 1,551 ms |
| コンパイル使用メモリ | 156,048 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-12 01:41:26 |
| 合計ジャッジ時間 | 2,266 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 11 RE * 19 |
ソースコード
//No.81 すべて足すだけの簡単なお仕事です。
import std.stdio;
import std.bigint;
import std.algorithm;
void main() {
uint length;
readf("%d\n", &length);
BigInt num;
BigInt deci;
for(uint i=0; i<length; i++) {
char[] a, b;
char[] orig;
readln(orig);
if(orig.canFind('.')) {
int j, pos = 0;
for(j=0; orig[j] != '.'; j++) {
a.length += 1;
a[j] = orig[j];
}
for(j+=1; orig[j] != '\n'; j++) {
b.length += 1;
b[pos++] = orig[j];
}
} else {
a.length = orig.length;
a = orig;
b.length = 10;
b = ['0','0','0','0','0','0','0','0','0','0'];
}
long l = b.length;
b.length = 10;
for(long lon = l; lon<10; lon++) {
b[lon] = '0';
}
BigInt biga = a;
BigInt bigb = b;
if(a[0] == '-')
bigb *= -1;
num += biga;
deci += bigb;
}
BigInt ten = 10000000000;
num += (deci / ten);
deci -= ((deci / ten) * ten);
writeln(num,'.',deci,'\n');
}