class Main {
public static void main(String args[]){
long count;
long max = 0;
long n = 0;
int from = 0, tmpFrom = 0;
int to = 0, tmpto = 0;
Scanner br = new Scanner(new BufferedInputStream(System.in));
while(br.hasNext()){
tmpFrom = from = br.nextInt();
tmpto = to = br.nextInt();
if(from>to){
to = tmpFrom;
from = tmpto;
}
max = 0;
for(long i=from; i<=to; i++){
count = 1;
n = i;
while(n != 1){
if((n & 1) == 1){
n = (n << 2) - n +1;
}else{
n = n >> 1;
}
count++;
}
if(count > max){
max = count;
}
}
System.out.println(tmpFrom + " " + tmpto + " " + max);
}
}
}
Henry Hong-Ning Dai
unread,
Jul 1, 2011, 10:59:36 AM7/1/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to acm-cp...@googlegroups.com
Dear Jeff,
Have your code passed the UVA online judge?
Regards, Henry
-- Hong-Ning Dai, Ph.D. Assistant Professor Faculty of Information Technology Macau University of Science and Technology Tel: (853) 8897 2154 Email: hndai...@gmail.com
聰┼聰
unread,
Jul 1, 2011, 11:02:08 AM7/1/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message