Handling large numbers
-
#include void main() { int t,j; scanf("%d",&t); for(j=0;j
-
#include void main() { int t,j; scanf("%d",&t); for(j=0;j
No. We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you. So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in! Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!
-
#include void main() { int t,j; scanf("%d",&t); for(j=0;j
-
#include void main() { int t,j; scanf("%d",&t); for(j=0;j
Just an observation... The only condition that will exit the
while()
loop is whennum
is equal to1
. Theif()
test after that will always print YES."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Just an observation... The only condition that will exit the
while()
loop is whennum
is equal to1
. Theif()
test after that will always print YES."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
A well known conjecture: Collatz conjecture - Wikipedia[^] (with many other names too). Cheers, Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
-
A well known conjecture: Collatz conjecture - Wikipedia[^] (with many other names too). Cheers, Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
Given the OP's code, I was simply pointing out that if too few operations are done, some numbers won't reach 1. For example, 47 takes 103 operations in order to reach 1, and 231 and 235 both take 127 operations in order to reach 1.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles