結果
| 問題 | 
                            No.81 すべて足すだけの簡単なお仕事です。
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2014-11-28 01:49:04 | 
| 言語 | D  (dmd 2.109.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,346 bytes | 
| コンパイル時間 | 1,652 ms | 
| コンパイル使用メモリ | 156,492 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-06-12 01:42:05 | 
| 合計ジャッジ時間 | 2,371 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 12 WA * 18 | 
ソースコード
//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;
	BigInt carry = deci / ten;
	BigInt sign = deci<0?BigInt(-1):BigInt(1);
	num += carry * sign;
	deci *= sign;
	deci -= (carry * 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);
}