#include #include #include #include #include #include #define rep(i,n) for(int i=0;i>n; int c=0; int m=n/1000000001; //1~mにいくつあるか探す int mk=log10(double(m))+1; if(mk%2==0){ int a=m/int(pow(10,double(mk/2))); c+=a-pow(10,double(mk/2)-1); int ga=0; rep(i,mk/2){ ga+=keta(a,mk/2-i)*pow(10,double(i)); } int b=m%int(pow(10,double(mk/2))); if(b>=ga){ c++; } }else{ int a=m/int(pow(10,double(mk/2))); c+=a-pow(10,double(mk/2)); int ga=0; rep(i,mk/2){ ga+=keta(a,mk/2-i+1)*pow(10,double(i)); } int b=m%int(pow(10,double(mk/2))); if(b>=ga){ c++; } } switch(mk-1){ case 8:c+=9000; case 7:c+=9000; case 6:c+=900; case 5:c+=900; case 4:c+=90; case 3:c+=90; case 2:c+=9; case 1:c+=9; case 0:; } cout<