結果
| 問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
hanorver
|
| 提出日時 | 2016-05-25 13:50:47 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 800 bytes |
| コンパイル時間 | 624 ms |
| コンパイル使用メモリ | 59,792 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-07 14:04:47 |
| 合計ジャッジ時間 | 2,300 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 WA * 8 RE * 6 |
ソースコード
#include<iostream>
#include<string>
#include<algorithm>
int main() {
int n;
std::cin >> n;
long long ans = 0;
for (int i = 0; i < n; i++) {
std::string no;
std::cin >> no;
int position = 0;
auto point = std::find(no.begin(), no.end(), '.');
long long num;
// 入力が小数なら小数点を取り整数化する
if (point != no.end()) {
position = point - no.begin();
no.erase(no.find('.'), 1);
num = std::stoll(no);
// 0.000000001を1の位になるように調整
for (int j = 0; j < 10 - (no.length() - position); j++) {
num *= 10;
}
} else {
num = std::stoll(no);
for (int i = 0; i < 10; i++) {
num *= 10;
}
}
ans += num;
}
std::string s = std::to_string(ans);
s.insert(s.length() - 10, ".");
std::cout << s << std::endl;
}
hanorver