fork download
  1. #include <bits/stdc++.h>
  2. #define endl '\n'
  3. using namespace std;
  4.  
  5. int n;
  6. int d[]={1,10,11,100,101,110,111,1000,1001,1010,1011,1100,1101,1110,1111,10000,10001,10010,10011,10100,10101,10110,10111,11000,11001,11010,11011,11100,11101,11110,11111,100000,100001,100010,100011,100100,100101,100110,100111,101000,101001,101010,101011,101100,101101,101110,101111,110000,110001,110010,110011,110100,110101,110110,110111,111000,111001,111010,111011,111100,111101,111110,111111,1000000,1000001,1000010,1000011,1000100,1000101,1000110,1000111,1001000,1001001,1001010,1001011,1001100,1001101,1001110,1001111,1010000,1010001,1010010,1010011,1010100,1010101,1010110,1010111,1011000,1011001,1011010,1011011,1011100,1011101,1011110,1011111,1100000,1100001,1100010,1100011,1100100,1100101,1100110,1100111,1101000,1101001,1101010,1101011,1101100,1101101,1101110,1101111,1110000,1110001,1110010,1110011,1110100,1110101,1110110,1110111,1111000,1111001,1111010,1111011,1111100,1111101,1111110,1111111,10000000,10000001,10000010,10000011,10000100,10000101,10000110,10000111,10001000,10001001,10001010,10001011,10001100,10001101,10001110,10001111,10010000,10010001,10010010,10010011,10010100,10010101,10010110,10010111,10011000,10011001,10011010,10011011,10011100,10011101,10011110,10011111,10100000,10100001,10100010,10100011,10100100,10100101,10100110,10100111,10101000,10101001,10101010,10101011,10101100,10101101,10101110,10101111,10110000,10110001,10110010,10110011,10110100,10110101,10110110,10110111,10111000,10111001,10111010,10111011,10111100,10111101,10111110,10111111,11000000,11000001,11000010,11000011,11000100,11000101,11000110,11000111,11001000,11001001,11001010,11001011,11001100,11001101,11001110,11001111,11010000,11010001,11010010,11010011,11010100,11010101,11010110,11010111,11011000,11011001,11011010,11011011,11011100,11011101,11011110,11011111,11100000,11100001,11100010,11100011,11100100,11100101,11100110,11100111,11101000,11101001,11101010,11101011,11101100,11101101,11101110,11101111,11110000,11110001,11110010,11110011,11110100,11110101,11110110,11110111,11111000,11111001,11111010,11111011,11111100,11111101,11111110,11111111,100000000,100000001,100000010,100000011,100000100,100000101,100000110,100000111,100001000,100001001,100001010,100001011,100001100,100001101,100001110,100001111,100010000,100010001,100010010,100010011,100010100,100010101,100010110,100010111,100011000,100011001,100011010,100011011,100011100,100011101,100011110,100011111,100100000,100100001,100100010,100100011,100100100,100100101,100100110,100100111,100101000,100101001,100101010,100101011,100101100,100101101,100101110,100101111,100110000,100110001,100110010,100110011,100110100,100110101,100110110,100110111,100111000,100111001,100111010,100111011,100111100,100111101,100111110,100111111,101000000,101000001,101000010,101000011,101000100,101000101,101000110,101000111,101001000,101001001,101001010,101001011,101001100,101001101,101001110,101001111,101010000,101010001,101010010,101010011,101010100,101010101,101010110,101010111,101011000,101011001,101011010,101011011,101011100,101011101,101011110,101011111,101100000,101100001,101100010,101100011,101100100,101100101,101100110,101100111,101101000,101101001,101101010,101101011,101101100,101101101,101101110,101101111,101110000,101110001,101110010,101110011,101110100,101110101,101110110,101110111,101111000,101111001,101111010,101111011,101111100,101111101,101111110,101111111,110000000,110000001,110000010,110000011,110000100,110000101,110000110,110000111,110001000,110001001,110001010,110001011,110001100,110001101,110001110,110001111,110010000,110010001,110010010,110010011,110010100,110010101,110010110,110010111,110011000,110011001,110011010,110011011,110011100,110011101,110011110,110011111,110100000,110100001,110100010,110100011,110100100,110100101,110100110,110100111,110101000,110101001,110101010,110101011,110101100,110101101,110101110,110101111,110110000,110110001,110110010,110110011,110110100,110110101,110110110,110110111,110111000,110111001,110111010,110111011,110111100,110111101,110111110,110111111,111000000,111000001,111000010,111000011,111000100,111000101,111000110,111000111,111001000,111001001,111001010,111001011,111001100,111001101,111001110,111001111,111010000,111010001,111010010,111010011,111010100,111010101,111010110,111010111,111011000,111011001,111011010,111011011,111011100,111011101,111011110,111011111,111100000,111100001,111100010,111100011,111100100,111100101,111100110,111100111,111101000,111101001,111101010,111101011,111101100,111101101,111101110,111101111,111110000,111110001,111110010,111110011,111110100,111110101,111110110,111110111,111111000,111111001,111111010,111111011,111111100,111111101,111111110,111111111,1000000000};
  7. int sol=0;
  8.  
  9. void start(){
  10. cin>>n;
  11. for(int i=0;i<512;i++){
  12. if(d[i]>n){
  13. cout<<sol<<endl;
  14. return;
  15. }
  16. else sol++;
  17. }
  18. cout<<sol<<endl;
  19.  
  20. }
  21.  
  22. int main(){
  23. ios_base::sync_with_stdio(false); cin.tie(NULL);
  24. start();
  25. return 0;
  26. }
Success #stdin #stdout 0s 5304KB
stdin
1000101 110110 1010011 1100101 1100001 110010 1110011 1001101 1001010 1100110 1111000 100000 101000 1010010 11111100 1100011 1101011 1110111 11100100 1110010 1110100 1110011 101001 101000 1011001 1010100 101001
stdout
69