[cpp]while(cin >> start >> end)
{
}[/cpp]
to my code and judge decided
Does anyone see what im doing wrong?Dear Dragoon:
Your program has not solved the problem. It ran during 0.040 seconds.
Here is my code:
[cpp]//judge@uva.es
//@JUDGE_ID: 20308JC 100 C++
//@BEGIN_OF_SOURCE_CODE
#include <iostream.h>
int maxcycle(int n)
{
int count = 1;
while(n != 1)
{
if(n % 2)
n = 3 * n + 1;
else
n = n / 2;
count++;
}
return count;
}
int main()
{
int start = 0;
int end = 0;
int temp = 0;
int largest = 0;
// cout << "Please enter 2 integers separated by a space or a new line:\n";
while(cin >> start >> end)
{
if(start > 0 && start < 10000 && end > 0 && end < 10000)
{
cout << start << " " << end << " ";
if(start < end)
{
while(start <= end)
{
temp = maxcycle(start);
if(temp > largest)
largest = temp;
start++;
}
}
if(start > end)
{
while(start >= end)
{
temp = maxcycle(end);
if(temp > largest)
largest = temp;
end++;
}
}
cout << largest << endl;
}
}
// else
// cout << "Integers must be between 0 and 10000.\n";
// main();
return 0;
}
//@END_OF_SOURCE_CODE[/cpp]