結果
問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
ユーザー |
|
提出日時 | 2014-11-28 01:30:31 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,067 bytes |
コンパイル時間 | 1,555 ms |
コンパイル使用メモリ | 160,296 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 01:41:38 |
合計ジャッジ時間 | 2,389 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 30 |
ソースコード
//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[] 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); writeln(num,'.',deci,'\n'); }