結果

問題 No.2562 数字探しゲーム(緑以下コンver.)
ユーザー MagentorMagentor
提出日時 2024-09-18 16:41:49
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 4,148 bytes
コンパイル時間 5,280 ms
コンパイル使用メモリ 315,928 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-18 16:41:57
合計ジャッジ時間 6,243 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 33 ms
6,944 KB
testcase_05 AC 33 ms
6,940 KB
testcase_06 AC 32 ms
6,940 KB
testcase_07 AC 33 ms
6,944 KB
testcase_08 AC 35 ms
6,940 KB
testcase_09 AC 34 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep2(i, m ,n) for (int i = (m); i < (long long)(n); i++)
#define REP(i, n) for (long long i = 1; i < (long long)(n); i++)
typedef long long ll;

#define updiv(N,X) (N + X - 1) / X
#define l(n) n.begin(),n.end()
#define mat vector<vector<ll>>
#define YesNo(Q) Q==1?cout<<"Yes":cout<<"No"
using P = pair<long long, long long>;

const int MOD = 998244353LL;
const ll INF = 999999999999999999LL;
vector<long long> fact, fact_inv, inv;
/*  init_nCk :二項係数のための前処理
    計算量:O(n)
*/
template <typename T>
void input(vector<T> &v){
 rep(i,v.size()){cin>>v[i];}
  return;
}
void init_nCk(int SIZE) {
    fact.resize(SIZE + 5);
    fact_inv.resize(SIZE + 5);
    inv.resize(SIZE + 5);
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE + 5; i++) {
        fact[i] = fact[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
}
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
long long nCk(int n, int k) {
    assert(!(n < k));
    assert(!(n < 0 || k < 0));
    return fact[n] * (fact_inv[k] * fact_inv[n - k] % MOD) % MOD;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll POW(ll a,ll n){
  long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}
struct unionfind{
  vector<int> par,siz;
  void reset(int n){par.resize(n);siz.resize(n);rep(i,n){par[i]=-1;siz[i]=1;}}
  
  int leader(int x){
   if(par[x]==-1){return x;}
   else{return par[x] = leader(par[x]);} 
  }
  
  bool same(int x,int y){
   return leader(x)==leader(y); 
  }
  
  bool merge(int x,int y){
   x = leader(x);y=leader(y);
   if(x == y){return false;}
   if(siz[x] < siz[y]){swap(x,y);} 
   par[y] = x;
  siz[x] += siz[y];
  return true; 
  }
  
  
 
int size(int x){
 return siz[leader(x)]; 
}
 
};
 
  struct graph{
vector<vector< pair<int,ll> > > val;  

void print(){
 rep(i,val.size()){
  rep(j,val[i].size()){
   cout << val[i][j].first<<"/" <<val[i][j].second << " ";
  }
   cout << endl;
 }
}
void resize(int n){
 val.resize(n); 
}
void add(int n,int k,ll cost){ assert((int)(val.size())>k);val[ n ].push_back( pair(k,cost) ); }
void add2(int n,int k,ll cost){ val[ n ].push_back( pair(k,cost) ); val[ k ].push_back( pair(n,cost) );}    
vector<ll> dfs_basic(int a){
 vector<ll>seen(val.size(),-1);
 queue<int> q;q.push(a);seen[a]=0;
 
 while(!q.empty()){
  int wc=q.front();
     q.pop();
  
  rep(i,val[wc].size()){
   if(-1==seen[val[wc][i].first]){q.push(val[wc][i].first);seen[val[wc][i].first]=seen[wc]+val[wc][i].second;} 
  }
 }
 return seen;  
 }
 
    
  vector<ll>dijkstra(int r){
    vector<ll> d(val.size(), INF);
    d[r] = 0;
    priority_queue<P, vector<P>, greater<P>> pq;
    pq.push(P(0, r));
    while (!pq.empty())
    {
        P p = pq.top();
        pq.pop();
        int dist = p.first, u = p.second;
        if (dist > d[u])
            continue;
        for (ll i = 0LL; i < (int)(val[u].size()); i++)
        {
            int v = val[u][i].first, w = val[u][i].second;
            if (d[v] > d[u] + w)
            {
                d[v] = d[u] + w;
                pq.push(P(d[v], v));
            }
        }
    } 
    return d;
  }
   
   
};

void solve(){
	ll a;cin>>a;
	ll v[9];
	rep(i,9){cin>>v[i];}
	ll y = 0;
	rep(i,9){
		rep(j,v[i]){
			y *= 10;
			y += i+1;
			
		}
	}
	y *= 1000000000LL;
	if(a==1000000000LL){
		cout << y << endl;
	}
	else{
		cout << y+(a-y%a) << endl;
	}
}
int main() {
int t;cin>>t;
while(t--){
	solve();
}
}
0