Question one hundred and fifty-three: No 62

Source: Internet
Author: User

[Plain] # include <stdio. h>
 
Int main ()
{
Int n;
Int m;
Int I;
Int t;
Int l;
Int flag;
Int count;
 
While (scanf ("% d", & n, & m )! = EOF & (n> 0 & n <1000000) | (m> 0 & m <1000000 ))
{
Count = 0; // calculate the number of unlucky numbers
For (I = n; I <= m; I ++)
{
Flag = 0;
T = I; // Replace I with him. This will not change the for loop.
While (t)
{
If (t % 10 = 4)
{
Count ++;
Flag = 0;
Break;
}
Else if (t % 10 = 2)
{
L = t; // replace t with t, so that the t value will not be changed. Otherwise, the calculation will fail.
L = l/10;
If (l % 10 = 6)
{
Count ++;
Break;
Flag = 1;
}
If (flag)
{
Break;
}
}
If (flag)
{
Break;
}
T = t/10;
}
}
 
Printf ("% d \ n", m-n-count + 1 );
}
 
Return 0;
}

# Include <stdio. h>

Int main ()
{
Int n;
Int m;
Int I;
Int t;
Int l;
Int flag;
Int count;

While (scanf ("% d", & n, & m )! = EOF & (n> 0 & n <1000000) | (m> 0 & m <1000000 ))
{
Count = 0; // calculate the number of unlucky numbers
For (I = n; I <= m; I ++)
{
Flag = 0;
T = I; // Replace I with him. This will not change the for loop.
While (t)
{
If (t % 10 = 4)
{
Count ++;
Flag = 0;
Break;
}
Else if (t % 10 = 2)
{
L = t; // replace t with t, so that the t value will not be changed. Otherwise, the calculation will fail.
L = l/10;
If (l % 10 = 6)
{
Count ++;
Break;
Flag = 1;
}
If (flag)
{
Break;
}
}
If (flag)
{
Break;
}
T = t/10;
}
}

Printf ("% d \ n", m-n-count + 1 );
}

Return 0;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.