結果
| 問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-16 20:39:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 969 bytes |
| コンパイル時間 | 581 ms |
| コンパイル使用メモリ | 67,872 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-04 11:03:41 |
| 合計ジャッジ時間 | 1,990 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 14 RE * 5 |
ソースコード
#include<iostream>
#include<string>
using namespace std;
typedef long long ll;
int main(){
int n;
ll accum = 0;
cin >> n;
string a;
for(int i = 0; i < n; i++){
cin >> a;
int dotpos;
for(dotpos = 0; dotpos < a.length(); dotpos++) if(a[dotpos] == '.') break;
ll val;
if(dotpos == a.length()){
val = stoll(a) * 10000000000;
}else{
int residual = 10;
while(dotpos != a.length()-1){
swap(a[dotpos], a[dotpos+1]);
residual--;
dotpos++;
}
val = stoll(a.substr(0, a.length()-1));
while(residual-- > 0) val *= 10;
}
accum += val;
}
string decimal = "";
for(int i = 0; i < 10; i++){
int digit = accum % 10;
decimal = (char)('0' + digit) + decimal;
accum /= 10;
}
cout << accum << "." << decimal << endl;
return 0;
}