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

take care.
Moderator: Board moderators
Code: Select all
2
X X
X X
Code: Select all
(removed)
Code: Select all
12
X XXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
0
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;
}
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;
}
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];
}
Code: Select all
while(1)
{
scanf("%c",&c);
check '\n'
{
Array=count;
check min(count<max)
max=count;
break;
}
otherwise(c==' ')
count++;
}
Code: Select all
3
XXX XXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXXXX
XXXXXXX XXXXXXXXXXXXXXXX
3
XXX XXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXXX
XXXXXXX XXXXXXXXXXXXXXXX
0
Code: Select all
0
1
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;
}
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;
}
Code: Select all
got acc