Cod sursa(job #891392)
Utilizator | Data | 25 februarie 2013 16:28:38 | |
---|---|---|---|
Problema | Lista lui Andrei | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.53 kb |
#include <fstream>
using namespace std;
bool m[26][26];
int main()
{
int v=1,i,n,l,pos=676;
int x,y;
char a,b;
ifstream fin("nrcuv.in");
ofstream fout("nrcuv.out");
fin>>l>>n;
for(i=0;i<n;i++)
{
fin>>a>>b;
x=a-'a';y=b-'a';
if(!m[x][y])
{
if(a==b)pos--;
else
pos-=2;
m[x][y]=1;
m[y][x]=1;
}
}
while(l)
{
v=v*pos;
v=v%104659;
l--;
}
fout<<v;
}