結果
| 問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
ty70
|
| 提出日時 | 2015-06-05 04:22:45 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,895 bytes |
| コンパイル時間 | 820 ms |
| コンパイル使用メモリ | 96,940 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-06 14:09:06 |
| 合計ジャッジ時間 | 1,687 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 30 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm> // require sort next_permutation count __gcd reverse etc.
#include <cstdlib> // require abs exit atof atoi
#include <cstdio> // require scanf printf
#include <functional>
#include <numeric> // require accumulate
#include <cmath> // require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip> // require setw
#include <sstream> // require stringstream
#include <cstring> // require memset
#include <cctype> // require tolower, toupper
#include <fstream> // require freopen
#include <ctime> // require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll,ll> LL;
LL func (string s ){
ll sign = 1LL;
if (s[0] == '-' ) {
sign = -1LL;
s = s.substr (1 );
} // end if
rep (i, s.length() ) if (s[i] == '.' ) s[i] = ' ';
stringstream ss (s );
int integer = 0LL;
string decimal = "";
ss >> integer >> decimal;
while (decimal.length() < 10 ){
decimal += '0';
} // end while
stringstream tt (decimal );
ll dec;
tt >> dec;
return LL (sign*integer, sign*dec );
}
string ll2s (ll m ){
stringstream ss;
ss << m;
string res; ss >> res;
while (res.length() < 10 ){
res = '0' + res;
} // end while
return res;
}
int main()
{
ios_base::sync_with_stdio(0);
int N; cin >> N;
vector<LL> num(N);
rep (i, N ){
string s; cin >> s;
num[i] = func (s );
} // end rep
ll sumi = 0LL, sumd = 0LL;
rep (i, N ){
sumi += num[i].first;
sumd += num[i].second;
// cerr << num[i].first << '.' << num[i].second << endl;
} // end rep
sumi += sumd/(ll)1e10;
string out2 = ll2s (abs((sumd + (ll)1e10 )%(ll)1e10 ) );
cerr << sumi << '.' << out2 << endl;
return 0;
}
ty70