結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー Zu_rin
提出日時 2020-05-22 12:16:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,048 bytes
コンパイル時間 743 ms
コンパイル使用メモリ 78,896 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-04 08:41:47
合計ジャッジ時間 1,883 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 14
権限があれば一括ダウンロードができます

ソースコード

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