Cod sursa(job #197628)
| Utilizator | Data | 5 iulie 2008 12:27:26 | |
|---|---|---|---|
| Problema | Grigo | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Junior Challenge 2008 | Marime | 0.62 kb |
#include <fstream>
using namespace std;
int a,b,ok;
ofstream fout ("grigo.out");
void citire()
{
ifstream fin ("grigo.in");
fin>>a>>b;
int x;
for (int i=0;i<b;i++)
{
fin>>x;
if (x==1)
ok=1;
}
}
void afisare()
{
if (ok==0)
fout<<0;
else
{
if (b==1)
fout<<1;
else
{
long long x=1;
for (int y=1;y<=a-b+1;y++)
{
x*=y;
x=x%1000003;
}
fout<<x;
}
}
}
int main ()
{
citire();
afisare();
}
