2014 Liaoning Repeat Number

Source: Internet
Author: User

Problem C: Repeat Number

Time Limit: 1 Sec memory limit: 128 MB
Submission: 23 Solution: 7
[Submit] [Status] [Forum]

Description

Definition: a + B = c, if all the digits of c are same (c is more than ten), then we call a and B are Repeat Number. my question is How many Repeat Numbers in [x, y].

Input

There are several test cases.

Each test cases contains two integers x, y (1 <= x <= y <= 1,000,000) described above.

Proceed to the end of file.

Output

For each test output the number of couple of Repeat Number in one line.

Sample Input

1 10 10 12

Sample output

5 2

Prompt

If a equals B, we can call a, B are Repeat Numbers too, and a is the Repeat Numbers for itself.

In this question, I am a violent person who has been given two points. Just enumerate the possible values of c. Then, find the minimum value of the difference between the intermediate point and the boundary.


#include
 
  #include
  
   #include
   
    #include#include
    
     #include
     
      using namespace std;vector
      
        G;void init(){ int k=1; for(int i=0;i<6;i++) { k=k*10+1; for(int j=1;j<=9;j++) G.push_back(k*j); }}int main(){ int x,y; init(); while(cin>>x>>y) { int p=lower_bound(G.begin(),G.end(),2*x)-G.begin(); int q=lower_bound(G.begin(),G.end(),2*y)-G.begin(); int ans=0; //for(int i=0;i<10;i++) // cout<
       
        2*y) q--; // cout<
        
         

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.