Page 6 of 10

Posted: Wed Sep 20, 2006 6:07 pm
by emotional blind
Dont create new thread when there already exist about that topic and
Dont Cry
:lol: there is search option
search for 119

PE !!!!!!!!!!!!!!!!!!!!!

Posted: Mon Dec 04, 2006 8:35 pm
by Iffat
i am getting PE...:x :x :x i don't know where is my mistake...even i read all the posts...
here is my code

Code: Select all

REMOVED
plz plz plz plz plz plz help me :cry: :cry: :cry: :cry: :cry: :cry:

Posted: Mon Dec 04, 2006 10:59 pm
by emotional blind
Iffat, dont print blank line after last case.

Posted: Tue Dec 05, 2006 8:29 am
by Iffat
thanks for reply...i changed the part of my code..but still P.E :(

Code: Select all

printf("\n\n");
for(i=1;i<=n;i++)
	{
		if(i!=1)
		 printf("\n");	
		printf("%s %ld",str[i],arr1[i]);
		
		strcpy(str[i],"\0");
	}

printf("\n");

thanx

Posted: Tue Dec 05, 2006 3:52 pm
by Jan
I think you have changed the wrong part. See the code below...

Code: Select all

caseno=0;
while(input())
{
	/* Process */
	if(caseno++)
		printf("\n");
	for(i=1;i<=n;i++)
		printf("%s %ld\n",str[i],arr1[i]);
	/* Rest of the Code, But no printing */
}
Hope it helps.

Not getting AC!

Posted: Mon Feb 12, 2007 8:49 am
by linux
What's wrong with my code? Can anyone help?

Code: Select all

#include<stdio.h>
#include<string.h>

main()
{
       int np,i,j,k,amount,ppbal[12],nopp,ebal;
       char ppname[10][12],whoname[12];

       while (scanf("%d",&np)!=EOF) {
               for (i=0;i<np;i++) {
                       scanf("%s",ppname[i]);
                       ppbal[i]=0;
               }
 /*Deleted after AC*/
               for (i=0;i<np;i++) {
                       printf("%s %d\n",ppname[i],ppbal[i]);
               }
               putchar('\n');

       }
       return 0;

}
The problem was in char string which should be declared greater for the NULL pointer. Got AC. :P

Posted: Sat Feb 17, 2007 2:19 pm
by newton
hmm!

Posted: Wed Mar 07, 2007 2:30 pm
by GoldExcalibur
my code got WA for times....I have tested it using some input case I found in this forum....n it produced right answer... Can anybody give me advice to correct my code? thanks a lot

Code: Select all


 /** DELETED AFTER AC **/


Posted: Tue Mar 27, 2007 3:13 pm
by GoldExcalibur
Isn't there anybody who can help me to find out where the mistake is?
I really can't find it....please give me any test case(s) which can help me figure out the mistake..really appreciate any help n response..thanks a lot.

Posted: Tue Mar 27, 2007 3:45 pm
by rio
Change

Code: Select all

while(!feof(stdin)){

  scanf("%d",&member);
to

Code: Select all

while (scanf("%d", &member) != EOF) {
I don't know why feof() doesn't work. I think its already discussed somewhere.

And don't print newline after the last case.
After AC, don't forget removing your code.

Posted: Tue Mar 27, 2007 6:02 pm
by GoldExcalibur
what a mistake....

Thanks rio.....mine is already AC, really appreciate your help. thanks

Posted: Fri May 04, 2007 4:21 pm
by owokko
I get a problem with 119. Can anyone help me, please

I have test the groups of size 0 and 1. and test the case i found in this board but still get wrong :cry: .

If the group with 0 person, my code will output "\n", if the group with equal or more than 1 person, it can work.

please test my code and find the bug.

my code

and th main test case
Input: http://fdemesmay.dyndns.org/cs/acm/v1/119.in
Output: http://fdemesmay.dyndns.org/cs/acm/v1/119.out

Code: Select all

//Question http://acm.uva.es/p/v1/119.html
//CPU: , Memory: 

#include <iostream>
#include <cstring>

using namespace std;

char name[10][13];

  
int main()
{   
while(true){
    if( cin.fail() )
        break; 
        
    int n, own[10];//={0};
    
    cin >> n;


     /* remove */
}

Posted: Fri May 04, 2007 8:09 pm
by Jan
Replace the following part

Code: Select all

...
int main()
{
while(true){
    if( cin.fail() )
        break;

    int n, own[10];//={0};

    cin >> n;
...
with

Code: Select all

...
int main()
{
    int n;

    while(cin >> n){

        int own[10];//={0};
...
Hope it helps.

Posted: Sat May 05, 2007 9:51 am
by owokko
Thanks for kindness reply. :D

I change the part in my code and solve the problem. :)

input sample

Posted: Wed Jun 27, 2007 7:53 pm
by MateuszM
I also had problem with WA in 119.
In my case it was wrong output when nr of presents was 0

try follwing input:

2
dave liz
dave 200 0
liz 100 1 dave


you should get output:
dave 100
liz -100