結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー kotamanegikotamanegi
提出日時 2017-09-12 00:23:35
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,722 bytes
コンパイル時間 842 ms
コンパイル使用メモリ 103,276 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 05:52:39
合計ジャッジ時間 1,694 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 WA -
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	int n;
	cin >> n;
	long long a = 0, b = 0;
	REP(i, n) {
		string s;
		cin >> s;
		int multi = 1;
		if (s[0] == '-') {
			multi = -1;
		}
		string big,small;
		int done = 0;
		for (int q = 0;q < s.length();++q) {
			if (s[q] != '-') {
				if (s[q] == '.') {
					done = 1;
				}
				else if (done == 0) {
					big.push_back(s[q]);
				}
				else small.push_back(s[q]);
			}
		}
		while (small.size() != 10) {
			small.push_back('0');
		}
		a += stoll(big)*multi;
		b += stoll(small)*multi;
	}
	a += b / 10000000000;
	b = b % 10000000000;
nexter:;
	if (b < 0) {
		b += 10000000000;
		a--;
		goto nexter;
	}
	if (a == 0) {
		if (b >= 0) {
			cout << "0.";
		}else{
			cout << "-0.";
		}
	}
	else if (a > 0) {
		cout << a << ".";
	}
	else {
		if (b > 0) {
			b = 10000000000-b;
			a++;
		}
		cout << "-" << abs(a) << ".";
	}
	string s;
	s = to_string(b);
	while (s.length() != 10) s.push_back('0');
	cout << s;
	cout << endl;
	return 0;
}
0