Search found 3 matches

by javacom
Thu Jan 05, 2012 4:34 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 319953

Re: If you get WA in problem 100, read me before post!

helloneo wrote:minNum != maxNum

should be

minNum <= maxNum
Thank you, it works. AC finally :)
by javacom
Sun Dec 25, 2011 7:12 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 319953

Please Help, why I am getting WA (100) c++ ?

could you please tell me why I'm getting WY (100 3n+1 problem) with this code ?

#include <iostream>
#include <algorithm>


using namespace std;
unsigned long int calc(unsigned long int val){
int counter=1;
while(val!=1){
if(val%2==0){
val=val/2;
counter++;
}
else{
val=val * 3 +1;
counter ...
by javacom
Sun Dec 25, 2011 6:47 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 319953

Re: If you get WA in problem 100, read me before post!

Could you please tell me why I get WY with this code ? :(

#include <iostream>
#include <algorithm>


using namespace std;
unsigned long int calc(unsigned long int val){
int counter=1;
while(val!=1){
if(val%2==0){
val=val/2;
counter++;
}
else{
val=val * 3 +1;
counter++;
}
}
return ...

Go to advanced search