結果

問題 No.2246 1333-like Number
ユーザー kumakuma
提出日時 2023-03-09 04:25:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 550 bytes
コンパイル時間 1,982 ms
コンパイル使用メモリ 196,068 KB
最終ジャッジ日時 2025-02-11 07:04:27
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  //9 + 81 + 81 + 81....
  ll N;
  cin >> N;
  vector<pll> pos;
  for (ll i = 1; i <= 9; ++i) {
    for (ll j = i + 1; j <= 9; ++j) {
      pos.push_back({i, j});
    }
  }
  N -= 1;//0index
  ll X = N / (ll)pos.size() + 1;
  N %= (ll)pos.size();
  ll a = pos.at(N).first, b = pos.at(N).second;
  string ans = to_string(a);
  for (ll i = 0; i < X; ++i) {
    ans += (char)('0' + b);
  }
  cout << ans << endl;
}
0