結果
| 問題 |
No.722 100×100=1000
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2018-08-04 18:19:46 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,055 bytes |
| コンパイル時間 | 852 ms |
| コンパイル使用メモリ | 84,204 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-29 19:26:57 |
| 合計ジャッジ時間 | 1,894 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:41:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
41 | scanf("%d%d", &a, &b);
| ~~~~~^~~~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*-
*
* 722.cc: No.722 100×100=1000 - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* constant */
/* typedef */
typedef long long ll;
/* global variables */
/* subroutines */
/* main */
int main() {
int a, b;
scanf("%d%d", &a, &b);
int n = 0, m = 0;
while (a != 0 && a % 10 == 0) a /= 10, n++;
while (b != 0 && b % 10 == 0) b /= 10, m++;
if (a != 0 && a >= -9 && a <= 9 && n >= 2 &&
b != 0 && b >= -9 && b <= 9 && m >= 2) {
printf("%d", a * b);
for (int k = n + m - 1; k > 0; k--) putchar('0');
putchar('\n');
}
else {
ll c = (ll)a * b;
for (int k = n + m; k > 0; k--) c *= 10;
if (c >= -99999999 && c <= 99999999) printf("%lld\n", c);
else puts("E");
}
return 0;
}
tnakao0123