結果

問題 No.207 世界のなんとか
ユーザー kitaji93kitaji93
提出日時 2020-08-12 16:16:24
言語 PHP
(8.3.4)
結果
AC  
実行時間 47 ms / 5,000 ms
コード長 495 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 31,172 KB
実行使用メモリ 31,276 KB
最終ジャッジ日時 2024-04-18 00:43:24
合計ジャッジ時間 1,681 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
30,792 KB
testcase_01 AC 42 ms
30,956 KB
testcase_02 AC 47 ms
30,832 KB
testcase_03 AC 41 ms
31,044 KB
testcase_04 AC 42 ms
31,216 KB
testcase_05 AC 42 ms
31,148 KB
testcase_06 AC 43 ms
31,004 KB
testcase_07 AC 43 ms
30,800 KB
testcase_08 AC 42 ms
30,812 KB
testcase_09 AC 42 ms
30,844 KB
testcase_10 AC 40 ms
31,220 KB
testcase_11 AC 39 ms
30,812 KB
testcase_12 AC 38 ms
31,276 KB
testcase_13 AC 40 ms
30,820 KB
testcase_14 AC 40 ms
30,912 KB
testcase_15 AC 41 ms
31,128 KB
testcase_16 AC 42 ms
31,172 KB
testcase_17 AC 41 ms
31,128 KB
testcase_18 AC 42 ms
31,204 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
list($a, $b) = explode(" ", trim(fgets(STDIN)));

for ($i = $a; $i <= $b; $i++) {
  if ($i % 3 === 0) {
    echo $i;
    echo PHP_EOL;
    continue;
  }
  if (containThreeInt($i)) {
    echo $i;
    echo PHP_EOL;
  }
}

function containThree($i)
{
  return (strpos((string)$i, '3') !== false);
}

function containThreeInt($i)
{
  if ($i % 10 === 3) {
    return true;
  }
  while ($i > 10) {
    $i = intdiv($i, 10);
    if ($i % 10 === 3) {
      return true;
    }
  }
  return false;
}
0