結果

問題 No.722 100×100=1000
ユーザー face4
提出日時 2018-08-03 22:32:41
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 667 bytes
コンパイル時間 700 ms
コンパイル使用メモリ 66,632 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-29 19:19:39
合計ジャッジ時間 1,810 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

typedef long long ll;

bool check(string x){
    if(x[x.length()-1] != '0' || x[x.length()-2] != '0')    return false;

    if(x[0] == '-') x = x.substr(1);
    for(int i = 1; i < x.length(); i++){
        if(x[i] != '0') return false;
    }

    return true;
}

int main(){
    string a, b;
    cin >> a >> b;

    bool judge = check(a) && check(b);

    ll x = stoll(a);
    ll y = stoll(b);

    if(judge){
        cout << x*y/10 << endl;
    }else{
        ll ans = x*y;
        if(abs(ans) <= 99999999){
            cout << ans << endl;
        }else{
            cout << "E" << endl;
        }
    }
    
    return 0;
}
0