# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3580 | wclee2265 | Inherited disease (kriii1_I) | C++98 | 0 ms | 1088 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#define MOD 1000000007
#define N 105
FILE *in=stdin;
FILE *out=stdout;
int n;
long long d[N];
int main()
{
int i,j;
long long total=1,tmp,t=1;
fscanf(in,"%d",&n);
for(i=1;i<=n;i++)
{
fscanf(in,"%lld",&d[i]);
for(j=1,tmp=0;j<i;j++)
{
d[j]*=i;
tmp+=d[j];
}
fprintf(out,"%d\n",total+tmp+d[i]-1);
d[i]--;
t*=i;
total+=t;
}
fclose(in);
fclose(out);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |