結果
| 問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-23 18:21:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 751 bytes |
| コンパイル時間 | 2,356 ms |
| コンパイル使用メモリ | 193,996 KB |
| 最終ジャッジ日時 | 2025-01-07 14:42:59 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 WA * 14 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
cin>>n;
ll a=0,b=0;
while (n--) {
string s;cin>>s;
int sign=1;
if (s[0]=='-') {
sign=-1;
s=s.substr(1);
}
int i;
for (i=0;i<s.size();i++)
if (s[i]=='.')
break;
if (i==s.size())
s+='.';
while (s.size()-1-i<10)
s+='0';
ll c,d;
sscanf(s.c_str(),"%lld.%lld",&c,&d);
a+=c*sign;
b+=d*sign;
if (b>=1e10) {
a++;
b-=1e10;
} else if (b<0) {
a--;
b+=1e10;
}
}
printf("%lld.%010lld\n",a,b);
return 0;
}