// Topcoder SRM 568 DIV 2, L1 TheSimilarNumbers
import java.util.*;
import java.math.*;
public class TheSimilarNumbers {
public static void main(String[] args) {
System.out.println(
//
new TheSimilarNumbers().find(
1000, 1000
));
}
public int find(int lower, int upper) {
int res = 0;
int x = lower;
while (x <= upper) {
res++;
x = x * 10 + 1;
}
return res;
}
}
No comments:
Post a Comment