pointer >= $this->count) { $str = trim(fgets(STDIN)); $this->arr = explode(' ', $str); $this->count = count($this->arr); $this->pointer = 0; } $result = $this->arr[$this->pointer]; $this->pointer++; return $result; } /** * @return bool */ public function hasNext() { return $this->pointer < $this->count; } /** * @return int */ public function nextInt() { return (int)$this->next(); } /** * @return float */ public function nextDouble() { return (double)$this->next(); } } function dentaku($A, $B) { $result = $A * $B; if ($result < -99999999 || 99999999 < $result) { $result = 'E'; } return $result; } // 初期化 $sc = new Scanner(); $yukiList = []; for ($i = 1; $i <= 9; $i++) { for ($n = 2; $n < 15; $n++) { $yukiList[] = $i * pow(10, $n); } } $A = $sc->nextInt(); $B = $sc->nextInt(); if (in_array($A, $yukiList) && in_array($B, $yukiList)) { $result = ($A * $B) / 10; } else { $result = dentaku($A, $B); } echo $result . "\n";