// lanqiao 1443 卡片(优化解法) #include using namespace std; // 优化思路,据题意所得,一定是1先被消耗完,只需考虑1何时消耗完即可 int main(){ int s = 2021; for(int i = 1; ;i++){ int t = i; while(t){ if(t%10 == 1) s--; if(s < 0){ cout << i - 1 << endl; return 0; } t /= 10; } } return 0; }