結果

問題 No.207 世界のなんとか
ユーザー Hiroki Ohta
提出日時 2016-12-17 23:00:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 707 bytes
コンパイル時間 441 ms
コンパイル使用メモリ 55,448 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 04:31:36
合計ジャッジ時間 1,176 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

constexpr int32_t MIN = 1;
constexpr int32_t MAX = 2000000000;

int main() {
  int32_t A, B;
  std::cin >> A >> B;

  if (A < MIN || A > MAX) {
    //std::cout << "Input invalid A" << std::endl;
    exit(-1);
  }

  if (B < MIN || B > MAX) {
    //std::cout << "Input invalid B" << std::endl;
    exit(-1);
  }

  if ((B - A) < 0 || (B - A) > 100) {
    //std::cout << "B - A is over 100 or under 0" << std::endl;
    exit(-1);
  }

  for (int32_t i = A; i <= B; i++) {

    if (i % 3 == 0) {
      std::cout << i << std::endl;
      continue;
    }

    if (std::to_string(i).find("3") != std::string::npos) {
      std::cout << i << std::endl;
      continue;
    }
  }
  return 0;
}
0