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?

Post by brianfry713 » Sat Dec 08, 2012 7:46 am

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

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

11636 - Hello World! - WA

Post by mourad.ghafiri » Fri Dec 28, 2012 2:46 am

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??

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

Re: 11636 - Hello World! - WA

Post by mourad.ghafiri » Fri Dec 28, 2012 5:32 am

"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?

Post by shondhi » Fri Apr 12, 2013 5:45 pm

Thanks, got ac..

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

11636 - Hello World!

Post by triplemzim » Fri Apr 26, 2013 1:48 am

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

Post by brianfry713 » Sat Apr 27, 2013 1:57 am

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

Post by triplemzim » Sat May 18, 2013 6:08 pm

got ac thanks....

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

11636-Hello World

Post by imran_12 » Wed Oct 22, 2014 7:35 pm

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: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11636-Hello World

Post by lighted » Thu Oct 23, 2014 4:23 am

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)
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

Post by imran_12 » Thu Oct 23, 2014 7:02 pm

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!

Post by This Is ERFAN » Sat Dec 06, 2014 1:53 am

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: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: Suggest some easy problems to solve

Post by lighted » Sat Dec 06, 2014 3:28 pm

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!

Post by Aseem chakrabarthy » Tue Jan 20, 2015 2:26 pm

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!

Post by brianfry713 » Wed Jan 21, 2015 11:53 pm

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

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

Re: 11636 - Hello World!

Post by lighted » Sat Jan 24, 2015 1:35 pm

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

Post Reply

Return to “Volume 116 (11600-11699)”