結果
問題 | No.722 100×100=1000 |
ユーザー |
|
提出日時 | 2018-09-16 18:59:36 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 142 ms / 2,000 ms |
コード長 | 1,181 bytes |
コンパイル時間 | 4,535 ms |
コンパイル使用メモリ | 77,748 KB |
実行使用メモリ | 41,492 KB |
最終ジャッジ日時 | 2024-12-29 19:37:50 |
合計ジャッジ時間 | 8,996 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder722 { private static Scanner sc; private static Printer pr; private static void solve() { long a = sc.nextInt(); long b = sc.nextInt(); if (a == 0 || b == 0) { pr.println(0); return; } int n = 0; long tmpa = a; while (tmpa % 10 == 0) { n++; tmpa /= 10; } int m = 0; long tmpb = b; while (tmpb % 10 == 0) { m++; tmpb /= 10; } if (Math.abs(tmpa) < 10 && Math.abs(tmpb) < 10 && n >= 2 && m >= 2) { pr.print(tmpa * tmpb); for (int i = 0; i < n + m - 1; i++) { pr.print('0'); } pr.println(); } else { if (a * b < 100_000_000 && a * b > -100_000_000) { pr.println(a * b); } else { pr.println('E'); } } } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes())); pr = new Printer(System.out); solve(); // pr.close(); pr.flush(); // sc.close(); } static String INPUT = null; private static class Printer extends PrintWriter { Printer(OutputStream out) { super(out); } } }