Pagini recente » Cod sursa (job #2689881) | Cod sursa (job #2330012) | Cod sursa (job #89152) | Cod sursa (job #3031660) | Cod sursa (job #1090361)
#include <fstream>
using namespace std;
ifstream is ("nrcuv.in");
ofstream os ("nrcuv.out");
int n, m, cnt, sol;
bool bc[30][30];
char x, y;
int main()
{
is >> n >> m;
for (int i = 1; i <= m; ++i)
{
is >> x >> y;
if (bc[x-97][y-97] == 0) bc[x-97][y-97] = 1, cnt++;
if (bc[y-97][x-97] == 0) bc[y-97][x-97] = 1, cnt++;
}
sol = 26;
for (int i = 1; i < n; ++i)
sol *= 26, sol %= 104659;
os << sol - cnt;
is.close();
os.close();
return 0;
}