保存されている過去のバージョンの一覧

2019年09月26日01時47分42秒

Codeforces Round #587 DIV3 E1問題 - Numerical Sequence (easy version)

Source

Codeforces Round #587 DIV3 E1問題
Problem description

問題概要

省略

解法

省略

cLayversion 20190925-1)のコード

C++に変換後のコードはこちら

//no-unlocked
ll K;
int buf[20], sz;

ll calc(ll n){
  ll i = 1, s = 1, x, c = 0, res = 0;
  while(s < n){
    x = min(10s, n) - s;
    res += c * x;
    res += x * (x+1) / 2 * i;
    c += i * x;
    s += x;
    i++;
  }
  return res;
}

{
  ll i, d, s, x;
  REP(rd_int()){
    rd(K--);

    x = bsearch_max[ll,x,0,5d8](calc(x) <= K);
    K -= calc(x);

    i = s = 1;
    d = 9;
    for(;;){
      if(K < i * d) break;
      K -= i * d;
      i++;
      d *= 10;
      s *= 10;
    }
    s += K / i;
    K %= i;

    sz = 0;
    while(s) buf[sz++] = s % 10, s /= 10;
    wt(buf[sz-1-K]);
  }
}

Current time: 2024年03月29日06時25分59秒
Last modified: 2019年09月26日01時47分42秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF587 CF_Div3_E
トップページに戻る

Logged in as: unknown user (not login)

ログイン: