Pagini recente » Cod sursa (job #662110) | Cod sursa (job #2778195) | Cod sursa (job #2136272) | Cod sursa (job #156236) | Cod sursa (job #292474)
Cod sursa(job #292474)
// restante.cpp : Defines the entry point for the console application.
//
#include <cstdio>
#include <algorithm>
using namespace std;
int n,cont=0,suma=0;
bool b;
char cit[18];
int me[18][36002];
int main()
{
int i,j;
freopen("restante.in","r",stdin);
freopen("restante.out","w",stdout);
scanf("%d\n",&n);
for(i=1;i<=n;i++)
{
fgets(cit,18,stdin);
for(j=0;cit[j];j++)
if(cit[j]=='\n')
{
cit[j]=0;
break;
}
sort(cit,cit+j);
b=1;
for(j=1;j<=cont+1;j++)
if(me[1][j]==cit[0])
{
me[0][j]=-1;
b=0;
break;
}
if(b)
{
cont++;
for(j=0;cit[j];j++)
me[j+1][cont]=cit[j];
}
}
for(i=1;i<=cont;i++)
suma=suma+me[0][i];
cont=cont+suma;
printf("%d",cont);
return 0;
}