結果

問題 No.207 世界のなんとか
ユーザー LanatusLanatus
提出日時 2024-01-20 21:46:56
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 3,213 bytes
コンパイル時間 1,253 ms
コンパイル使用メモリ 107,500 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-20 21:46:59
合計ジャッジ時間 2,831 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 3 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <deque>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>

#define all(v) begin(v), end(v)
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)

using namespace std;

template <class S, class T> inline bool chmax(S &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class S, class T> inline bool chmin(S &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class S> using pqg = priority_queue<S, vector<S>, greater<S>>;
template <class S> using pq = priority_queue<S>;

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vvpi = vector<vpi>;
using vvpl = vector<vpl>;

const ll MOD = 1000000007;
const ll MAX = 500000;
const ll INF = 1000000000;
const ll INFLL = 1000000000000000000;

struct mint {
  ll x;

  mint(ll x = 0) : x((x % MOD + MOD) % MOD) {}
  mint operator+=(const mint &a) {
    x += a.x;
    if (x >= MOD)
      x -= MOD;
    return *this;
  }
  mint operator-=(const mint &a) {
    if (x < a.x)
      x += MOD;
    x -= a.x;
    return *this;
  }
  mint operator*=(const mint &a) {
    x = x * a.x % MOD;
    return *this;
  }
  mint operator/=(const mint &a) { return *this *= a.inv(); }
  mint operator+(const mint &a) const { return mint(*this) += a; }
  mint operator-(const mint &a) const { return mint(*this) -= a; }
  mint operator*(const mint &a) const { return mint(*this) *= a; }
  mint operator/(const mint &a) const { return mint(*this) /= a; }
  mint inv(void) const { return pow(MOD - 2); }
  mint pow(ll a) const {
    if (!a)
      return 1;
    mint t = pow(a >> 1);
    t *= t;
    if (a & 1)
      t *= (*this);
    return t;
  }
  friend ostream &operator<<(ostream &os, const mint &a) {
    os << a.x;
    return os;
  }
};

struct UnionFind {
  vector<int> parent, siz;

  UnionFind(int n) : parent(n), siz(n, 1) {
    for (int i = 0; i < n; ++i)
      parent[i] = i;
  }

  int root(int x) {
    if (parent[x] == x)
      return x;
    return parent[x] = root(parent[x]);
  }

  bool unite(int x, int y) {
    x = root(x);
    y = root(y);

    if (x == y)
      return false;

    if (siz[x] > siz[y])
      swap(x, y);

    siz[y] += siz[x];
    parent[x] = y;

    return true;
  }

  int size(int x) { return siz[root(x)]; }

  bool same(int x, int y) { return root(x) == root(y); }
};

long long modpow(long long a, long long n) {
  if (!n) return 1;
  if (n % 2) return (a * modpow(a, n - 1)) % MOD;
  long long t = modpow(a, n / 2);
  return t * t % MOD;
}

int main(void) {
  int a, b;
  cin >> a >> b;

  auto f = [&](int x) {
    int t = x;
    if (x % 3 == 0) return true;

    while (t) {
      if (t % 10 == 3) return true;
      t /= 10;
    }

    return false;
  };

  int ans = 0;
  for (int i = a; i <= b; ++i) {
    if (f(i)) cout << i << endl;
  }

  return 0;
}
0