Files
lanqiao/12lanqiao/test2-2.cpp

19 lines
459 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// lanqiao 1443 卡片(优化解法)
#include<bits/stdc++.h>
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;
}