結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー fiordfiord
提出日時 2015-06-21 09:08:58
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 785 bytes
コンパイル時間 1,907 ms
コンパイル使用メモリ 52,344 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-21 13:01:24
合計ジャッジ時間 1,454 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 WA -
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 WA -
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
		}
	}
	if(syo>0&&sei<0){
		sei++;
		syo-=E;
		syo*=-1;
	}
	printf("%lld.%010lld\n",sei,syo);
	return 0;
}
0