結果
問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
ユーザー |
![]() |
提出日時 | 2017-08-11 18:36:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 849 bytes |
コンパイル時間 | 2,042 ms |
コンパイル使用メモリ | 167,828 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 20:43:05 |
合計ジャッジ時間 | 2,526 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 20 |
コンパイルメッセージ
main.cpp:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 13 | main(){ | ^~~~
ソースコード
#include<bits/stdc++.h> typedef long long ll; using namespace std; int INF = 1e9; int MOD = 1000000007; ll pow(int n){ ll ans = 1; for(int i = 0;i < n;i++){ ans *= 10; } return ans; } main(){ int N; ll usum = 0,dsum = 0; cin >> N; for(int i = 0;i < N;i++){ int nflag = 1; ll a,b = 0; string s; cin >> s; if(s[0] == '-'){ nflag = -1; s.erase(s.begin()); } int index = s.find("."); if(index != -1){ a = stoll(s.substr(0,index)); b = stoll(s.substr(index+1,s.length()-index-1)); b *= pow(11-s.length()+index); }else a = stoll(s); usum += a * nflag; dsum += b * nflag; } usum += dsum / pow(10); dsum %= pow(10); printf("%lld.%010lld\n",usum,dsum); }