Okay, so I swapped the values in i > j...it still says my code does not solve the problem...wtf?
Here is the latest version:
[cpp]
#include <iostream.h>
long int cycles(long int n)
{
long int counter = 0;
if(n != 1)
{
while( n != 1)
{
if(n % 2 == 0)
n = n / 2;
else
n = n * 3 + 1 ...
Search found 5 matches
- Mon Apr 29, 2002 7:03 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 318350
- Mon Apr 29, 2002 7:01 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 318350
Still having problems...
Okay, so I swapped the values in i > j...it still says my code does not solve the problem...wtf?
Here is the latest version:
#include <iostream.h>
long int cycles(long int n)
{
long int counter = 0;
if(n != 1)
{
while( n != 1)
{
if(n % 2 == 0)
n = n / 2;
else
n = n * 3 + 1 ...
Here is the latest version:
#include <iostream.h>
long int cycles(long int n)
{
long int counter = 0;
if(n != 1)
{
while( n != 1)
{
if(n % 2 == 0)
n = n / 2;
else
n = n * 3 + 1 ...
- Mon Apr 29, 2002 6:07 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 318350
DUMB
I didn't want to look at your site for help, but I did....its always something simple that throws me off track...
thanks
jim
thanks
jim
- Mon Apr 29, 2002 5:43 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 318350
it checks
My code checks out... I get the same answers as the example input/output...What I want to know is how the judge interprets the input/output... My program takes one line at a time, carriage return, then outputs the repsonse. For some reason, it won't take with the judge.
- Mon Apr 29, 2002 5:21 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 318350
100, how does the input work?
I'm having problems understanding how the judge enters input data. Specifically, I wrote the following to take two integers from standard input like '1<space>10<cr>', then it outputs the answer like '1<space>10<space>20<cr>'. What is the problem? Thank you for your help!
#include <iostream.h>
int ...
#include <iostream.h>
int ...