結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー Zu_rinZu_rin
提出日時 2020-05-22 12:16:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,048 bytes
コンパイル時間 752 ms
コンパイル使用メモリ 79,264 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 01:25:18
合計ジャッジ時間 1,488 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <map>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

ll Makell(string s) {
	ll i = 0, k = 1, ans = 0;
	rep(i, s.size()) {
		ans *= 10;
		ans += s[i] - '0';
	}
	return ans * k;
}

int main(void) {
	ll num, i, j, ans = 0, a = 0, b = 0, k;
	string s, t;
	cin >> num;
	rep(i, num) {
		cin >> s;
		t = "";
		k = 1;
		j = 0;
		if (s[0] == '-') {
			j = 1;
			k = -1;
		}
		for (; j < s.size() && s[j] != '.'; j++)
			t += s[j];
		a += k * Makell(t);
		t = "";
		for (j++; j < s.size(); j++)
			t += s[j];
		j = 10 - t.size();
		for (; j > 0; j--)
			t += '0';
		b += k * Makell(t);
	}
	a += b / 10000000000ll;
	b %= 10000000000ll;
	if (b < 0) {
		a--;
		b += 10000000000ll;
	}
	printf("%lld.%010lld\n", a, b);
	return 0;
}
0