結果
問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
ユーザー |
![]() |
提出日時 | 2015-06-21 09:06:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 733 bytes |
コンパイル時間 | 372 ms |
コンパイル使用メモリ | 56,584 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-07 15:25:40 |
合計ジャッジ時間 | 1,310 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 WA * 14 |
ソースコード
#include <iostream> #include <cstdio> #include <string> using namespace std; #define E 10000000000 typedef long long int ll; int main(){ int n; cin>>n; string a; ll sei=0,syo=0; for(int i=0;i<n;i++){ cin>>a; ll tsei=0,tsyo=0; int syocnt=0; bool plus=true,seisyo=true; for(int j=0;j<(int)a.size();j++){ if(a[j]=='.') seisyo=false; else if(a[j]=='-') plus=false; else{ if(seisyo) tsei=tsei*10+(ll)(a[j]-'0'); else{ tsyo=tsyo*10+(ll)(a[j]-'0'); syocnt++; } } } for(int j=syocnt;j<10;j++) tsyo*=10; if(plus){ syo+=tsyo; sei+=tsei+(syo/E); syo%=E; } else{ syo-=tsyo; if(syo<0){ sei--; syo+=E; } sei-=tsei; } } printf("%lld.%010lld\n",sei,syo); return 0; }