結果
問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
ユーザー |
![]() |
提出日時 | 2015-07-30 21:39:44 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 597 bytes |
コンパイル時間 | 560 ms |
コンパイル使用メモリ | 66,636 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-17 22:40:25 |
合計ジャッジ時間 | 1,670 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 WA * 15 |
ソースコード
#include <iostream> #include <algorithm> #include <sstream> #include <vector> #include <cmath> #include <cstdio> using namespace std; int main(int argc, char *argv[]) { int N; cin >> N; long double a = 0, b = 0, d; for (int i = 0; i < N; ++i) { cin >> d; long double n = round(d); a += n; b += (d - n); while (b >= 1) { a += 1; b -= 1; } while (b <= -1) { a -= 1; b += 1; } } if (b < 0) { if (a < 0) { b = -b; } else { a -= 1; b = 1 + b; } } char w[16]; sprintf(w, "%.10lf", (double)b); printf("%lld%s\n", (long long)a, w + 1); return 0; }