## 11636 - Hello World!

All about problems in Volume 116. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: 11636 - Hello World!, why wa?

input 10000 correct output is 14.
Check input and AC output for thousands of problems on uDebug!

New poster
Posts: 6
Joined: Thu Dec 20, 2012 9:25 pm

### 11636 - Hello World! - WA

is there any problem with the server ??!!!

because i generated all possible answers (1 to 10000 ) from uvatoolkit and it gives the same result i get with my solution but the server answers me with WA:

my code :

Code: Select all

``````import java.util.Scanner;

public class Main{

public static void main(String[] args) {

Scanner in = new Scanner(System.in);
int c=1;
while(in.hasNextInt()){
int n = in.nextInt();
if(n==-1) break;
System.out.println("Case "+c+": "+minCopy_Past(n));
c++;
}
}

static int minCopy_Past(int goal){
int min = 0;
int test = 1;
while(test<goal){
for (int i =2*test ; i>=1 ; i--) {
if((test+i/2)<=goal){
test+=i/2;
min++;
break;
}
}
}
return min;
}
}
``````

so where is the problem??

New poster
Posts: 6
Joined: Thu Dec 20, 2012 9:25 pm

### Re: 11636 - Hello World! - WA

"any negative number shouldn't processed"
so the test must be if(n<0) break;

finally it's AC

shondhi
New poster
Posts: 25
Joined: Tue Oct 02, 2012 5:24 pm
Location: Chittagong
Contact:

### Re: 11636 - Hello World!, why wa?

Thanks, got ac..

triplemzim
New poster
Posts: 48
Joined: Sat Apr 06, 2013 6:02 pm

### 11636 - Hello World!

here is my code...
#include<iostream>

using namespace std;

int main()
{
int i=0,j=1,k=0,num;
while(1)
{
k++;
cin>>num;
if(num<0) break;

while(j<num)
{
j=j*2; i++;
}
cout<<"Case "<<k<<": "<<i<<endl;
}
}

why am i getting WA??

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: 11636 Hello world WA

Try input:
10
2
-1
Check input and AC output for thousands of problems on uDebug!

triplemzim
New poster
Posts: 48
Joined: Sat Apr 06, 2013 6:02 pm

### Re: 11636 Hello world WA

got ac thanks....

imran_12
New poster
Posts: 9
Joined: Fri Sep 19, 2014 7:56 am

### 11636-Hello World

Code: Select all

``````Got AC...silliest mistake ever...deleted just one symbol and it got accepted!!! :p
Thank u so much... :)``````
Last edited by imran_12 on Thu Oct 23, 2014 7:00 pm, edited 1 time in total.

lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

### Re: 11636-Hello World

Post in existing thread. Don't open new thread. Use search(11636).

Input

Code: Select all

``````8
64
32
-1``````
Acc Output

Code: Select all

``````Case 1: 3
Case 2: 6
Case 3: 5``````
Don't forget to remove your code after getting accepted.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

imran_12
New poster
Posts: 9
Joined: Fri Sep 19, 2014 7:56 am

### Re: 11636-Hello World

Got AC...silliest mistake ever...deleted just one symbol and it got accepted!!! :p
Thank u so much...

This Is ERFAN
New poster
Posts: 6
Joined: Thu Dec 04, 2014 11:40 pm

### Re: 11636 Hello world!

Why getting WA...??
plz help me out

Code: Select all

``````#include<stdio.h>

int main()
{
int test,i,a,j;
scanf("%d",&test);
for(i=1;i<=test;i++)
{
scanf("%d",&a);
int count=0,x=1;
for(j=0;x<a;j++)
{
x=x+x;
count++;

}
printf("Case %d: %d\n",i,count);

}
return 0;
}``````

lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

### Re: Suggest some easy problems to solve

For problem 11636 you should post in Volume CXVI.

Your code doesn't match sample I/O. First number of input is not number of test cases. You should read input numbers until you reach negative number.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

Aseem chakrabarthy
New poster
Posts: 5
Joined: Mon Jan 19, 2015 12:12 pm
Location: University of Chittagong

### Re: 11636 - Hello World!

Why getting wrong answer?? plz help me...

Code: Select all

``````#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int n,i,test,copy,line;
cin>>test;
for(i=1;i<=test;i++)
{
cin>>n;
if(n<0)
{
break;
}
if(n==0)
{
cout<<"Case "<<i<<": "<<"0"<<endl;
}
else
{
n=ceil(log(n)/log(2));
cout<<"Case "<<i<<": "<<n<<endl;
}

}
}``````
Last edited by brianfry713 on Tue Jan 20, 2015 10:10 pm, edited 1 time in total.
Reason: Added code blocks

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: 11636 - Hello World!

Try solving it without using floating point.
Check input and AC output for thousands of problems on uDebug!

lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

### Re: 11636 - Hello World!

Your input reading is not correct. First number is not "number of test cases". Change code to

Code: Select all

``````int n,i,test,copy,line;

for(i=1; 1;i++)
{
cin>>n;
if(n<0)
{
break;
}
..``````
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman