Cod sursa(job #303366)
| Utilizator | Data | 9 aprilie 2009 19:55:30 | |
|---|---|---|---|
| Problema | Grigo | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.41 kb |
#include<stdio.h>
long n,m,st,aa,i;
long long ua,a1;
int main()
{
freopen("grigo.in","r",stdin);
freopen("grigo.out","w",stdout);
scanf("%ld%ld",&n,&m);
st=1;
ua=1;
for(i=1;i<=m;++i)
{scanf("%ld",&aa);
for(st;st<aa;++st)
{a1=(ua*(st-1))%1000003;
ua=a1;}
++st;}
for(st;st<=n;++st)
{a1=(ua*(st-1))%1000003;
ua=a1;}
printf("%lld\n",a1);
return 0;
}
