Skip to content

Instantly share code, notes, and snippets.

@KT-Yeh
Created February 3, 2014 09:46
Show Gist options
  • Save KT-Yeh/8781086 to your computer and use it in GitHub Desktop.
Save KT-Yeh/8781086 to your computer and use it in GitHub Desktop.
#include <cstdio>
using namespace std;
int main()
{
// freopen ("input.txt","rt",stdin);
int N;
while (scanf("%d",&N)){
if (!N) break;
int nOfX[20]={0},Max = 0;
char line[30];
gets(line);
for (int i=0; i<N; i++){
gets(line);
for (int j=0; line[j]; j++)
if (line[j]=='X') nOfX[i]++;
if (nOfX[i]>Max)
Max = nOfX[i];
}
int ans = 0;
for (int i=0; i<N; i++)
ans += (Max-nOfX[i]);
printf("%d\n",ans);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment