結果
問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
ユーザー |
|
提出日時 | 2014-11-28 01:43:32 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,265 bytes |
コンパイル時間 | 1,708 ms |
コンパイル使用メモリ | 156,160 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-12 01:42:02 |
合計ジャッジ時間 | 3,056 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 20 |
ソースコード
//No.81 すべて足すだけの簡単なお仕事です。 import std.stdio; import std.bigint; import std.algorithm; import std.conv; void main() { uint length; readf("%d\n", &length); BigInt num; BigInt deci; for(uint i=0; i<length; i++) { char[] orig; readln(orig); BigInt biga; BigInt bigb; if(orig.canFind('.')) { char[] a, b; 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]; } long l = b.length; b.length = 10; for(long lon = l; lon<10; lon++) { b[lon] = '0'; } biga = BigInt(a); bigb = BigInt(b); if(a[0] == '-') bigb *= -1; } else { char[] a; a.length = orig.length-1; for(int j=0; orig[j] != '\n'; j++) a[j] = orig[j]; biga = BigInt(a); bigb = BigInt("0"); } num += biga; deci += bigb; } BigInt ten = 10000000000; num += (deci / ten); deci -= ((deci / ten) * ten); /*char[] deciString = deci.toString("10d"); int diff = deciString.le; deciString.length = 10; for(int i=diff; i<10;i++) deciString[i] = '0';*/ char[] deciString; writef("%d.%010d\n", num, deci); }