結果

問題 No.722 100×100=1000
ユーザー ohreitetsuohreitetsu
提出日時 2018-10-30 21:37:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,024 bytes
コンパイル時間 549 ms
コンパイル使用メモリ 64,752 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 15:34:03
合計ジャッジ時間 1,517 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	string A,B;
	cin>>A>>B;
	long long A1,B1;
	sscanf((char*)A.c_str(),"%lld",&A1);
	sscanf((char*)B.c_str(),"%lld",&B1);
	if (A1<100 || B1<100){
		cout<<A1*B1<<endl;
		return 0;
	}

	int zeroNum=0;
	bool bAllZero=true;
	int i=1;
	int sign=0;
	char ACh,BCh;
	if (A[0]=='-'){
		sign=1;
		i++;
		ACh=A[1];
	}else{
		ACh=A[0];
	}

	for (;i<A.size();i++){
		if (A[i]!='0'){
			bAllZero=false;
			break;
		}
		zeroNum++;
	}
	if (bAllZero){
		i=1;

		if (B[0]=='-'){
			if (sign==0){
				sign=1;
			}else{
				sign=0;
			}
			BCh=B[1];
			i++;
		}else{
			BCh=B[0];
		}
		for (;i<B.size();i++){
			if (B[i]!='0'){
				bAllZero=false;
				break;
			}
			zeroNum++;
		}
	}
	if (bAllZero){
		if (sign==1){
			cout<<"-";
		}
		cout<<(ACh-'0')*(BCh-'0');
		for (i=1;i<zeroNum;i++){
			cout<<"0";
		}
		cout<<endl;
		return 0;
	}
	long long C=A1*B1;
	if (C<-99999999 || C>99999999){
		cout<<"E"<<endl;
		return 0;
	}
	cout<<C<<endl;
	return 0;
}
0