結果
| 問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
ku_material_ro
|
| 提出日時 | 2016-09-29 15:23:21 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,051 bytes |
| コンパイル時間 | 645 ms |
| コンパイル使用メモリ | 65,044 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-21 10:29:19 |
| 合計ジャッジ時間 | 3,932 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 WA * 2 RE * 20 |
ソースコード
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;
int main(){
string s;
string si;
string sd;
string ss="";
int n;
int keta;
int kuriagari;
long long in = 0;
long long de = 0;
long long toi = 0;
long long tod = 0;
int index;
cin >> n;
for (int i = 0; i < n; i++){
cin >> s;
index = (int)s.find(".");
if (index == -1){
in = stoi(s);
de = 0;
}
else{
si = s.substr(0, index);
sd = s.substr(index + 1, s.length() - index);
for (int is = 10 - sd.length(); is>0; is--){
sd += "0";
}
in = stoi(si);
de = stoi(sd);
}
toi += in;
tod += de;
}
if (tod > 0){
keta = 10 - ((int)log10(tod) + 1);
}
else{
keta = 9;
}
if (keta<0){
kuriagari = tod / 10000000000;
toi += kuriagari;
tod -= kuriagari * 10000000000;
if (tod > 0){
keta = 10 - ((int)log10(tod) + 1);
}
else{
keta = 9;
}
}
//cout << keta << endl;
while (keta > 0){
ss += "0";
keta--;
}
//cout << ss << endl;
cout << toi << "." << ss << tod << endl;
return 0;
}
ku_material_ro