Search found 2 matches

by Laurent
Mon Apr 26, 2004 11:23 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 212011

I undersood the problem

I thought that
[cpp]
while (!cin.eof())
[/cpp]
worked. But it only worked in problem 103.
I solved 3 new problems by understanding that.
by Laurent
Mon Apr 26, 2004 11:59 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 212011

problem 100 and 102

Hello, I have problem with 100 and 102. I have W.A. replies. I think it may be the same type of mistake so I send my two programs : 100 : [cpp] #include <iostream> using namespace std; int calcprof2(int k) { int i = 0; while (k != 1) { ++i; k = (k&1)?(3*k+1):(k/2); } return i; } int main() { int...

Go to advanced search