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<