Page 2 of 3

Re: 11636 - Hello World!, why wa?

Posted: Sat Dec 08, 2012 7:46 am
by brianfry713
input 10000 correct output is 14.

11636 - Hello World! - WA

Posted: Fri Dec 28, 2012 2:46 am
by mourad.ghafiri
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??

Re: 11636 - Hello World! - WA

Posted: Fri Dec 28, 2012 5:32 am
by mourad.ghafiri
"any negative number shouldn't processed" :)
so the test must be if(n<0) break;

finally it's AC

Re: 11636 - Hello World!, why wa?

Posted: Fri Apr 12, 2013 5:45 pm
by shondhi
Thanks, got ac..

11636 - Hello World!

Posted: Fri Apr 26, 2013 1:48 am
by triplemzim
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??

Re: 11636 Hello world WA

Posted: Sat Apr 27, 2013 1:57 am
by brianfry713
Try input:
10
2
-1

Re: 11636 Hello world WA

Posted: Sat May 18, 2013 6:08 pm
by triplemzim
got ac thanks....

11636-Hello World

Posted: Wed Oct 22, 2014 7:35 pm
by imran_12

Code: Select all

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

Re: 11636-Hello World

Posted: Thu Oct 23, 2014 4:23 am
by lighted
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. 8)

Re: 11636-Hello World

Posted: Thu Oct 23, 2014 7:02 pm
by imran_12
Got AC...silliest mistake ever...deleted just one symbol and it got accepted!!! :p
Thank u so much... :)

Re: 11636 Hello world!

Posted: Sat Dec 06, 2014 1:53 am
by This Is ERFAN
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;
}

Re: Suggest some easy problems to solve

Posted: Sat Dec 06, 2014 3:28 pm
by lighted
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.

Re: 11636 - Hello World!

Posted: Tue Jan 20, 2015 2:26 pm
by Aseem chakrabarthy
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;
        }


    }
}

Re: 11636 - Hello World!

Posted: Wed Jan 21, 2015 11:53 pm
by brianfry713
Try solving it without using floating point.

Re: 11636 - Hello World!

Posted: Sat Jan 24, 2015 1:35 pm
by lighted
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;
    }
    ..