結果
| 問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-11-07 05:00:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,011 bytes |
| コンパイル時間 | 1,559 ms |
| コンパイル使用メモリ | 163,412 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-15 00:26:13 |
| 合計ジャッジ時間 | 2,912 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 WA * 3 |
ソースコード
// 想定解
#include <bits/stdc++.h>
using namespace std;
void rc(int v,int mn,int mx){if(v<mn||mx<v){cerr<<"error"<<endl;exit(1);}}
#define REP(i, n) for(int(i)=0;(i)<(n);++(i))
const int MAXN = 100;
const long long MAXF = 10000000000LL;
void f(const string &s, long long &ip, long long &fp){
stringstream ss(s);
string vf; char delim;
ss >> ip >> delim >> vf;
while(vf.size()<10) vf += "0";
stringstream ssf(vf);
ssf >> fp;
if(s[0] == '-') fp=-fp;
//cerr << ip << "." << fp << endl;
}
int main(){
int N;
cin >> N; rc(N, 0, MAXN);
long long inte=0,frac=0;
REP(i, N){
string s; cin >> s;
long long vi=0,vf=0;
f(s, vi, vf);
inte += vi; frac += vf;
}
while(frac < 0){inte--; frac += MAXF; }
while(frac >= MAXF){inte++; frac -= MAXF; }
if(inte < 0 && frac > 0){
inte++; frac = MAXF - frac;
}
printf("%lld.%010lld\n", inte, frac);
return 0;
}