public static void main(String[] args) {
Scanner input = new Scanner(System.in);
while (input.hasNext()) {
long i = input.nextLong();
long j = input.nextLong();
int maxCount = 0;
int count;
long n;
for (long j2 = i; j2 <= j; j2++) {
count = 0;
n = j2;
while (n != 1) {
if (n % 2 != 0) {
n = 3 * n + 1;
} else {
n = n / 2;
}
count++;
}
count++;
if (count >= maxCount) {
maxCount = count;
}
}
System.out.println(i+" "+j+" "+maxCount);
}
}
}
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
What does this have to do with Android (which this forum is all about) ?
You should also post what the actual problem is. Folks here are unlikely to know what the UVA web site is or does, and what, exactly, you mean by "it doesn't accept my code".