結果
| 問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
le_panda_noir
|
| 提出日時 | 2020-06-13 17:23:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 849 bytes |
| コンパイル時間 | 1,070 ms |
| コンパイル使用メモリ | 71,408 KB |
| 最終ジャッジ日時 | 2025-01-11 03:49:13 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 WA * 2 RE * 9 |
ソースコード
#include <iostream>
using namespace std;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
int main() {
int N; cin >> N;
long long ans = 0;
rep(i, N) {
string s; cin >> s;
auto pos = s.find(".");
if (s == "0") continue;
if (pos == string::npos)
s += "0000000000";
else {
int len = s.size() - 1 - pos;
rep(j, 10-len)
s += "0";
s = (s.substr(0, pos) == "0" ? "" : s.substr(0, pos)) + s.substr(pos+1);
}
ans += stoll(s);
}
string s = to_string(ans);
if (s.size() == 10)
cout << "0." << s << endl;
else if (s[0] == '-' && s.size() == 11)
cout << "-0." << s.substr(1) << endl;
else
cout << s.substr(0, s.size()-10) << "." << s.substr(s.size()-10) << endl;
return 0;
}
le_panda_noir