Page 2 of 4

Posted: Thu Jun 22, 2006 9:05 pm
by deena sultana
oh, hw STUPID i m!

Thank u very much ASIF. i get ac now. i m so happy. :D

take care.

Posted: Tue Aug 15, 2006 8:43 pm
by kolpobilashi
:( anyone can say where is my mistake?

Code: Select all

removed after AC
thanx in advance.....

Posted: Tue Aug 15, 2006 9:18 pm
by mamun
What should be output for the following you think

Code: Select all

2
X                       X
X                       X

Posted: Tue Aug 15, 2006 10:47 pm
by kolpobilashi
OOpS!!! its a silly mistake :oops: ......
thanx a lot Mamun bhaia......AC now :D

414 WA, could someone help me?

Posted: Wed Feb 21, 2007 7:08 pm
by Lyaxe
this is my code, I'm using c++

Code: Select all

(removed)
I don't find anything wrong in my code, could someone give me an input to prove my code wrong?

Posted: Wed Feb 21, 2007 9:55 pm
by Vexorian

Code: Select all

12
X XXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
0
The right result is 1 (obviously). Think: why does your solution output 24 for this case? =).

Please remove your code after reading this post so it doesn't spoil the fun to others.

Posted: Thu Feb 22, 2007 5:08 am
by Lyaxe
thanks a lot, now I realize my mistake :D

414WA..Help

Posted: Sat Feb 09, 2008 10:13 am
by AcmNightivy
my thought is to find the max num of the 'X', and do sub to find..And i have tested lots of cases..Maybe there is something wrong with my I/0..Help.!

Code: Select all

#include <iostream.h>
#include "string.h"

int main ()
{
	char str[13][26];
	int count[13];
	int row;
	int max;
	int i, j;

	while (cin>>row && row)
	{
		max = 0;
		for (i = 0; i < row; i++)
		{
			cin.get ();
			cin.getline (str[i], 26);	
		}

		for (i = 0; i < row; i++)
		{
			count[i] = 0;
			for (j = 0; str[i][j] != '\0'; j++)
				if (str[i][j] == 'X')
					count[i]++;

			if (count[i] > max)
				max = count[i];
		}

		j = 0;
		for (i = 0; i < row; i++)
			if (count[i] < max)
				j += max - count[i];

		cout<<j<<endl;
	}
	return 0;
}

Posted: Sat Feb 09, 2008 8:28 pm
by Jan
Use existing thread.

Posted: Sun Feb 10, 2008 7:32 am
by AcmNightivy
my thought is to find the max num of the 'X', and do sub to find..And i have tested lots of cases..Help.!

Code: Select all

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

int main ()
{
	char str[13][26];
	int count[13];
	int row;
	int max;
	int i, j;

	while (cin>>row && row)
	{
		max = 0;
		for (i = 0; i < row; i++)
		{
			gets (str[i]);	
		}

		for (i = 0; i < row; i++)
		{
			count[i] = 0;
			for (j = 0; str[i][j] != '\0'; j++)
				if (str[i][j] == 'X')
					count[i]++;

			if (count[i] > max)
				max = count[i];
		}

		j = 0;
		for (i = 0; i < row; i++)
			if (count[i] < max)
				j += max - count[i];

		cout<<j<<endl;
	}
	return 0;
}

Posted: Wed Feb 27, 2008 9:21 pm
by turcse143

Code: Select all

for (i = 0; i < row; i++)
      {
         gets (str[i]);   
      }

      for (i = 0; i < row; i++)
      {
         count[i] = 0;
         for (j = 0; str[i][j] != '\0'; j++)
            if (str[i][j] == 'X')
               count[i]++;

         if (count[i] > max)
            max = count[i];
      } 
this code creates WA.
u can use

Code: Select all

while(1)
{
	scanf("%c",&c);
        check '\n'
	{
	    Array=count;
	    check min(count<max)
		     max=count;
		    break;
	}
	otherwise(c==' ')
		 count++;
}
hope it helps.

Posted: Mon Mar 03, 2008 12:29 pm
by deadangelx
this input and output may help you to understand this problem easily

input

Code: Select all

3
XXX  XXXXXXXXXXXXXXXXXXXX
XXXXX  XXXXXXXXXXXXXXXXXX
XXXXXXX  XXXXXXXXXXXXXXXX
3
XXX  XXXXXXXXXXXXXXXXXXXX
XXXXX   XXXXXXXXXXXXXXXXX
XXXXXXX  XXXXXXXXXXXXXXXX
0
output

Code: Select all

0
1

Re: 414 WA, need help!

Posted: Mon Jun 09, 2008 4:55 pm
by iit2006039

Code: Select all

#include<iostream>
#include<cmath>
#include<vector>
#include<sstream>
#include<string>
#include<iomanip>
#include<algorithm>

using namespace std;
            
int main()
{
int num;
cin>>num;
while(num!=0)
{
 			 string s;
 			 vector<string> arr(num);
 			 getline(cin,s);
 			  for(int i=0;i<num;i++)
 			  getline(cin,arr[i]);
 			  int min=30;
 			  vector<int > mani(num);
			   for(int i=0;i<num;i++)
 			  {
			   		   mani[i]=arr[i].rfind(' ')-arr[i].find(' ');
			   		   if(min>mani[i])
			   		   min=mani[i];
			   }
			   //cout<<min<<endl;
			   int ret=0;
			   for(int i=0;i<num;i++)
			   ret+=mani[i]-min;
  		  	  cout<<ret<<endl;
  		  	  cin>>num;
}           
return 0;
}


somebody please point out the error...:(

Re: 414 WA, need help!

Posted: Sun Jan 25, 2009 12:09 am
by aug21st
getting WA
any help!!1
working for sample cases that are available

Code: Select all

#include<stdio.h>
int main()
{
int n;
int min,tot,temp;
int i,j,k,flag=0;
char stemp[25];
scanf("%d",&n);
while(n!=0)
{
	tot=0;
	min=-1;
	for(i=0;i<n;i++)
	{
		scanf("%s",stemp);
		j=0;
		while(stemp[j]!='\0')
			j++;
		if(j==25)
		{
			min=0;
		}
		else
		{
			scanf("%s",stemp);
			k=0;
			while(stemp[k]!='\0')
				k++;
			temp=25-(k+j);
			tot+=temp;
			if(temp<min || min==-1)
				min=temp;
		}
	}
	tot=tot-(n*min);
	if(flag!=0)
		printf("\n");
	printf("%d",tot);
	flag=1;
	scanf("%d",&n);
}
return 0;
}

Re: 414 WA, need help!

Posted: Sun Jan 25, 2009 9:57 am
by Obaida
Some one plz help me. I got wa. I am confused about my mistake.

Code: Select all

got acc