結果
問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
ユーザー |
![]() |
提出日時 | 2017-09-12 00:23:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,722 bytes |
コンパイル時間 | 1,371 ms |
コンパイル使用メモリ | 103,936 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-07 15:58:56 |
合計ジャッジ時間 | 2,035 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 3 |
ソースコード
#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; }