WA#5 90pts 求调
查看原帖
WA#5 90pts 求调
1296826
lcfollower楼主2024/9/15 22:05

rt

# include <bits/stdc++.h>

# define int long long
# define rint register int

using namespace std;

int n ,p;
char s[1000000];

signed main(){
  cin >> n >> p;
  s[0] = '1';
  if(p > n * 9){putchar('1'); for(rint i = 1 ; i < n ;i ++) putchar('0') ; exit(0);}
  int tot = n - 1;
  while(p && tot >= 1){
    if(p <= 9) s[tot] = char(47 + p) , p = 0; 
    else s[tot] = '9' ,p -= 9;
    -- tot;
  } if(p) s[0] = char(48 + p);
  for(rint i = 1 ;i <= tot;i ++) s[i] = '0';
  cout << s << endl;
  return 0;
} 
2024/9/15 22:05
加载中...