結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー te-sh
提出日時 2016-08-29 16:45:59
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 582 bytes
コンパイル時間 1,924 ms
コンパイル使用メモリ 172,432 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 03:49:09
合計ジャッジ時間 2,709 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.array, std.container, std.range;
import std.string, std.conv, std.bigint, std.math, std.random;
import std.stdio, std.typecons;

const k = 10000000000;

void main()
{
  auto n = readln.chomp.to!int;
  auto ai = iota(n).map!((_) {
    auto rd = readln.chomp.split('.');
    auto i = rd[0].to!long;
    auto d = rd.length == 2 ? rd[1].leftJustify(10, '0').to!long : 0;
    if (rd[0].front == '-') d *= -1;
    return BigInt(i) * k + BigInt(d);
  });

  auto r = ai.sum;

  if (r < 0) {
    write("-");
    r = -r;
  }
  writefln("%d.%010d", r / k, r % k);
}
0