結果
| 問題 |
No.722 100×100=1000
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-12 11:09:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 742 bytes |
| コンパイル時間 | 659 ms |
| コンパイル使用メモリ | 67,672 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-12 11:09:21 |
| 合計ジャッジ時間 | 2,277 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:21:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
21 | scanf("%lld%lld",&a,&b);
| ~~~~~^~~~~~~~~~~~~~~~~~
ソースコード
#include<iostream>
#include<cassert>
#define rep(i,n) for(i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll a,b;
const int MAX=(int)(1e8);
bool is_ten_power(ll x){
int i;
string xs=to_string(x);
for(i=1;i<xs.length();i++)if(xs[i]!='0')return false;
return true;
}
int main(){
int cnt_digit=0;
bool is_positive=true;
scanf("%lld%lld",&a,&b);
if(a<0)is_positive=!is_positive,a=-a;
if(b<0)is_positive=!is_positive,b=-b;
if(a>=100&&b>=100&&is_ten_power(a)&&is_ten_power(b)){
a/=10;
printf("%lld\n",a*b*(is_positive?1:-1));
}else{
if(a*b<MAX)printf("%lld\n",a*b*(is_positive?1:-1));
else puts("E");
}
return 0;
}