Search found 3 matches

by DavidFromArmenia
Tue Oct 03, 2006 3:18 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320201

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

#include <iostream>
using namespace std;

int main()
{
int i, j, k, count = 0, maxlength = 0;
while (cin >> i >> j){
if (i > j){
k = j;
j = i;
i = k;
}
if (i <= 0)
i = 1;
cout << i << ' ' << j << ' ';
////////////////////////////////////
while (i <= j ){
k = i;
count = 1;
while (k ...
by DavidFromArmenia
Tue Oct 03, 2006 3:00 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320201

problem 100 3n + 1

I have a problem with wrong answer.
why?
#include <iostream>
using namespace std;

int main()
{
int i, j, k, count = 0, maxlength = 0;
while (cin >> i >> j){
if (i > j){
k = j;
j = i;
i = k;
}
if (i <= 0)
i = 1;
cout << i << ' ' << j << ' ';
////////////////////////////////////
while (i ...
by DavidFromArmenia
Tue Oct 03, 2006 2:59 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320201

problem 100 3n + 1

I have a problem with wrong answer.
why?
#include <iostream>
using namespace std;

int main()
{
int i, j, k, count = 0, maxlength = 0;
while (cin >> i >> j){
if (i > j){
k = j;
j = i;
i = k;
}
if (i <= 0)
i = 1;
cout << i << ' ' << j << ' ';
////////////////////////////////////
while (i ...

Go to advanced search