# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3082 | tncks0121 | Hexagon travel (kriii1_H) | C++98 | 0 ms | 1084 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>
double last[3][6],now[3][6],ans[3];
int col[3][6] = {{1,2,1,2,1,2},{2,0,2,0,2,0},{0,1,0,1,0,1}};
char S[410]; int L,P;
int main()
{
int i,c,d,nc,nd;
scanf ("%d %d",&L,&P);
scanf ("%s",S);
last[2][0] = 1;
for (i=0;S[i];i++){
for (c=0;c<3;c++) for (d=0;d<6;d++) now[c][d] = last[c][d] * P / 100;
for (c=0;c<3;c++) for (d=0;d<6;d++){
if (S[i] == 'M') nc = col[c][d], nd = d;
if (S[i] == 'L') nc = c, nd = (d + 5) % 6;
if (S[i] == 'R') nc = c, nd = (d + 1) % 6;
now[nc][nd] += last[c][d] * (100 - P) / 100;
}
for (c=0;c<3;c++) for (d=0;d<6;d++) last[c][d] = now[c][d];
}
for (c=0;c<3;c++) for (d=0;d<6;d++) ans[c] += last[c][d];
for (c=0;c<3;c++) printf ("%.9lf\n",ans[c]+1e-9);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |