結果

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

ソースコード

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;
  if (N <= 9) {
    cout << N << endl;
    return 0;
  }
  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