11636 - Hello World!
Moderator: Board moderators
-
- 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 :
so where is the problem??
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

so the test must be if(n<0) break;
finally it's AC
Re: 11636 - Hello World!, why wa?
Thanks, got ac..
-
- 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??
#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??
-
- 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
10
2
-1
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 48
- Joined: Sat Apr 06, 2013 6:02 pm
Re: 11636 Hello world WA
got ac thanks....
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.
Re: 11636-Hello World
Post in existing thread. Don't open new thread. Use search(11636).
InputAcc Output
Don't forget to remove your code after getting accepted. 
Input
Code: Select all
8
64
32
-1
Code: Select all
Case 1: 3
Case 2: 6
Case 3: 5

A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
Re: 11636-Hello World
Got AC...silliest mistake ever...deleted just one symbol and it got accepted!!! :p
Thank u so much...
Thank u so much...

-
- New poster
- Posts: 6
- Joined: Thu Dec 04, 2014 11:40 pm
Re: 11636 Hello world!
Why getting WA...??
plz help me out
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;
}
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.
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
-
- 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
Reason: Added code blocks
-
- 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!
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