結果

問題 No.3625 Find Superfibonacci Number
コンテスト
ユーザー Tehom
提出日時 2026-08-14 22:02:28
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,316 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,951 ms
コンパイル使用メモリ 377,692 KB
実行使用メモリ 9,412 KB
最終ジャッジ日時 2026-08-14 22:02:33
合計ジャッジ時間 5,424 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repl(i,a,b) for(ll i=(a);i<(b);i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

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

bool check(int x,int k){
  vector<int> v;
  int tmp=x;
  int sum=0;
  while(tmp){
    sum+=tmp%10;
    v.push_back(tmp%10);
    tmp/=10;
  }
  if(sum != k){
    return false;
  }
  bool ch=false;
  rep(i,0,(int)v.size()-2){
    if(v[i]+v[i+1]<v[i+2]) ch=true;
  }
  return ch;
}

void solve(){
  int k; cin >> k;
  if(k<=17){
    rep(i,1,10000){
      if(check(i,k)){
        cout << i << "\n";
        return;
      }
    }
  }
  else{
    string ans;
    k-=17;
    while(k>0){
      if(k<10){
        ans+=to_string(k);
        break;
      }
      else{
        ans+="9";
        k-=9;
      }
    }
    reverse(all(ans));
    if(ans[0] == '8' || ans[0] == '9') ans="809"+ans;
    else ans+="809";
    cout << ans << "\n";
  }

  return;
}
  
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int T=1;
  cin >> T;
  rep(_,0,T){
    solve();
  }
}
0