今天的主人公是什么?

60.1K!!!!

先扔代码再更新防止我等会儿一上头不打算写完题解

T1:

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const double inf=;
int n,k;
double a[],f[][];
int main()
{
scanf("%d%d",&n,&k);
for(int i=;i<=n;i++)scanf("%lf",&a[i]);
sort(a+,a+n+);
n=unique(a+,a+n+)-a-;
for(int i=;i<=n;i++){
for(int j=;j<=k;j++)f[j][i]=inf;
}
f[][]=;
for(int i=;i<=n;i++){
for(int j=;j<=k;j++){
for(int l=;l<=i;l++){
f[j][i]=min(f[j][i],f[j-][l-]+(a[i]-a[l])*(a[i]-a[l]));
}
}
}
if(k>=n)printf("0.00\n");
else printf("%.2lf\n",f[k][n]);
return ;
}

T2:

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
int val[][],a[],n,opt,num,goal,sum;
double p[][][][],dice[][],ans[][],b[][][][];
char s[][];
int main()
{
// freopen("1.out","w",stdout);
for(int i=;i<=;i++){
for(int j=;j<=;j++)scanf("%1d",&val[i][j]);
scanf("%d",&a[i]);
}
p[a[]][a[]][a[]][a[]]=;
dice[][]=;
scanf("%d",&n);
for(int i=;i<=;i++){
for(int j=;j<=(i<<);j++){
dice[i][j]=(dice[i-][j]/3.00);
if(j)dice[i][j]+=(dice[i-][j-]/3.00);
if(j>=)dice[i][j]+=(dice[i-][j-]/3.00);
}
}
for(int i=;i<=n;i++){
memset(s[],,sizeof(s[]));
memset(s[],,sizeof(s[]));
memset(s[],,sizeof(s[]));
memset(s[],,sizeof(s[]));
scanf("%s%s",s[],s[]);
if(s[][]=='<'||s[][]=='>'){
int x;
scanf("%d",&x);
scanf("%s%s",s[],s[]);
if(s[][]=='<'){
if(s[][]=='='){
if(s[][]=='i')opt=;
else if(s[][]=='p')opt=;
else if(s[][]=='a')opt=;
else opt=;
if(s[][]=='i')goal=;
else if(s[][]=='p')goal=;
else if(s[][]=='a')goal=;
else goal=;
if(s[][]=='+')num=s[][]-'';
else num=-(s[][]-'');
if(s[][]=='?'){//<=?
for(int a1=;a1<=;a1++){
for(int b1=;b1<=;b1++){
for(int c1=;c1<=;c1++){
for(int d1=;d1<=;d1++){
for(int l=;l<=((abs(num))<<);l++){
if(opt==){
for(int k=;k<=(val[][a1]<<);k++){
if(k<=x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k]*dice[abs(num)][l];
}
}
}
else if(opt==){
for(int k=;k<=(val[][b1]<<);k++){
if(k<=x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k]*dice[abs(num)][l];
}
}
}
else if(opt==){
for(int k=;k<=(val[][c1]<<);k++){
if(k<=x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k]*dice[abs(num)][l];
}
}
}
else{
for(int k=;k<=(val[][d1]<<);k++){
if(k<=x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k]*dice[abs(num)][l];
}
}
}
}
}
}
}
}
}
else{//<=x
for(int a1=;a1<=;a1++){
for(int b1=;b1<=;b1++){
for(int c1=;c1<=;c1++){
for(int d1=;d1<=;d1++){
if(opt==){
for(int k=;k<=(val[][a1]<<);k++){
if(k<=x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
}
}
else if(opt==){
for(int k=;k<=(val[][b1]<<);k++){
if(k<=x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
}
}
else if(opt==){
for(int k=;k<=(val[][c1]<<);k++){
if(k<=x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
}
}
else{
for(int k=;k<=(val[][d1]<<);k++){
if(k<=x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
}
}
}
}
}
}
}
}
else{
if(s[][]=='i')opt=;
else if(s[][]=='p')opt=;
else if(s[][]=='a')opt=;
else opt=;
if(s[][]=='i')goal=;
else if(s[][]=='p')goal=;
else if(s[][]=='a')goal=;
else goal=;
if(s[][]=='+')num=s[][]-'';
else num=-(s[][]-'');
if(s[][]=='?'){//<?
for(int a1=;a1<=;a1++){
for(int b1=;b1<=;b1++){
for(int c1=;c1<=;c1++){
for(int d1=;d1<=;d1++){
for(int l=;l<=((abs(num))<<);l++){
if(opt==){
for(int k=;k<=(val[][a1]<<);k++){
if(k<x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k]*dice[abs(num)][l];
}
}
}
else if(opt==){
for(int k=;k<=(val[][b1]<<);k++){
if(k<x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k]*dice[abs(num)][l];
}
}
}
else if(opt==){
for(int k=;k<=(val[][c1]<<);k++){
if(k<x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k]*dice[abs(num)][l];
}
}
}
else{
for(int k=;k<=(val[][d1]<<);k++){
if(k<x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k]*dice[abs(num)][l];
}
}
}
} }
}
}
}
}
else{//<x
for(int a1=;a1<=;a1++){
for(int b1=;b1<=;b1++){
for(int c1=;c1<=;c1++){
for(int d1=;d1<=;d1++){
if(opt==){
for(int k=;k<=(val[][a1]<<);k++){
if(k<x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
}
}
else if(opt==){
for(int k=;k<=(val[][b1]<<);k++){
if(k<x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
}
}
else if(opt==){
for(int k=;k<=(val[][c1]<<);k++){
if(k<x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
}
}
else{
for(int k=;k<=(val[][d1]<<);k++){
if(k<x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
}
}
}
}
}
}
}
}
}
else{
if(s[][]=='='){
if(s[][]=='i')opt=;
else if(s[][]=='p')opt=;
else if(s[][]=='a')opt=;
else opt=;
if(s[][]=='i')goal=;
else if(s[][]=='p')goal=;
else if(s[][]=='a')goal=;
else goal=;
if(s[][]=='+')num=s[][]-'';
else num=-(s[][]-'');
if(s[][]=='?'){//>=?
for(int a1=;a1<=;a1++){
for(int b1=;b1<=;b1++){
for(int c1=;c1<=;c1++){
for(int d1=;d1<=;d1++){
for(int l=;l<=((abs(num))<<);l++){
if(opt==){
for(int k=;k<=(val[][a1]<<);k++){
if(k>=x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k]*dice[abs(num)][l];
}
}
}
else if(opt==){
for(int k=;k<=(val[][b1]<<);k++){
if(k>=x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k]*dice[abs(num)][l];
}
}
}
else if(opt==){
for(int k=;k<=(val[][c1]<<);k++){
if(k>=x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k]*dice[abs(num)][l];
}
}
}
else{
for(int k=;k<=(val[][d1]<<);k++){
if(k>=x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k]*dice[abs(num)][l];
}
}
}
} }
}
}
}
}
else{//>=x
for(int a1=;a1<=;a1++){
for(int b1=;b1<=;b1++){
for(int c1=;c1<=;c1++){
for(int d1=;d1<=;d1++){
if(opt==){
for(int k=;k<=(val[][a1]<<);k++){
if(k>=x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
}
}
else if(opt==){
for(int k=;k<=(val[][b1]<<);k++){
if(k>=x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
}
}
else if(opt==){
for(int k=;k<=(val[][c1]<<);k++){
if(k>=x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
}
}
else{
for(int k=;k<=(val[][d1]<<);k++){
if(k>=x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
}
}
}
}
}
}
}
}
else{
if(s[][]=='i')opt=;
else if(s[][]=='p')opt=;
else if(s[][]=='a')opt=;
else opt=;
if(s[][]=='i')goal=;
else if(s[][]=='p')goal=;
else if(s[][]=='a')goal=;
else goal=;
if(s[][]=='+')num=s[][]-'';
else num=-(s[][]-'');
if(s[][]=='?'){//>?
for(int a1=;a1<=;a1++){
for(int b1=;b1<=;b1++){
for(int c1=;c1<=;c1++){
for(int d1=;d1<=;d1++){
for(int l=;l<=((abs(num))<<);l++){
if(opt==){
for(int k=;k<=(val[][a1]<<);k++){
if(k>x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][a1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k]*dice[abs(num)][l];
}
}
}
else if(opt==){
for(int k=;k<=(val[][b1]<<);k++){
if(k>x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][b1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k]*dice[abs(num)][l];
}
}
}
else if(opt==){
for(int k=;k<=(val[][c1]<<);k++){
if(k>x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][c1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k]*dice[abs(num)][l];
}
}
}
else{
for(int k=;k<=(val[][d1]<<);k++){
if(k>x){
if(goal==){
if(a1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(a1+(num<?-:)*l>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1+(num<?-:)*l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
else if(goal==){
if(b1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(b1+(num<?-:)*l>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1][b1+(num<?-:)*l][c1][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
else if(goal==){
if(c1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(c1+(num<?-:)*l>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1][b1][c1+(num<?-:)*l][d1]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
else{
if(d1+(num<?-:)*l<=)b[][][][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else if(d1+(num<?-:)*l>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
else b[a1][b1][c1][d1+(num<?-:)*l]+=p[a1][b1][c1][d1]*dice[abs(num)][l]*dice[val[][d1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k]*dice[abs(num)][l];
}
}
}
} }
}
}
}
}
else{//>x
for(int a1=;a1<=;a1++){
for(int b1=;b1<=;b1++){
for(int c1=;c1<=;c1++){
for(int d1=;d1<=;d1++){
if(opt==){
for(int k=;k<=(val[][a1]<<);k++){
if(k>x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][a1]][k];
}
}
}
else if(opt==){
for(int k=;k<=(val[][b1]<<);k++){
if(k>x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][b1]][k];
}
}
}
else if(opt==){
for(int k=;k<=(val[][c1]<<);k++){
if(k>x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][c1]][k];
}
}
}
else{
for(int k=;k<=(val[][d1]<<);k++){
if(k>x){
if(goal==){
if(a1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(a1+num>=)b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
else if(goal==){
if(b1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(b1+num>=)b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
else if(goal==){
if(c1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(c1+num>=)b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
else{
if(d1+num<=)b[][][][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else if(d1+num>=)b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
else b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
}
else{
b[a1][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[val[][d1]][k];
}
}
}
}
}
}
}
}
}
}
for(int a1=;a1<=;a1++){
for(int b1=;b1<=;b1++){
for(int c1=;c1<=;c1++){
for(int d1=;d1<=;d1++){
p[a1][b1][c1][d1]=b[a1][b1][c1][d1];
b[a1][b1][c1][d1]=;
// printf("%d %d %d %d %lf\n",a1,b1,c1,d1,p[a1][b1][c1][d1]);
}
}
}
}
b[][][][]=p[][][][];
}
else{
if(s[][]=='?'){
if(s[][]=='i')opt=;
else if(s[][]=='p')opt=;
else if(s[][]=='a')opt=;
else opt=;
if(s[][]=='+')num=s[][]-'';
else num=-(s[][]-'');
if(num<){
num=-num;
for(int a1=;a1<=;a1++){
for(int b1=;b1<=;b1++){
for(int c1=;c1<=;c1++){
for(int d1=;d1<=;d1++){
for(int l=;l<=(num<<);l++){
if(opt==){
if(a1-l>)b[a1-l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[num][l];
else b[][][][]+=p[a1][b1][c1][d1]*dice[num][l];
}
else if(opt==){
if(b1-l>)b[a1][b1-l][c1][d1]+=p[a1][b1][c1][d1]*dice[num][l];
else b[][][][]+=p[a1][b1][c1][d1]*dice[num][l];
}
else if(opt==){
if(c1-l>)b[a1][b1][c1-l][d1]+=p[a1][b1][c1][d1]*dice[num][l];
else b[][][][]+=p[a1][b1][c1][d1]*dice[num][l];
}
else{
if(d1-l>)b[a1][b1][c1][d1-l]+=p[a1][b1][c1][d1]*dice[num][l];
else b[][][][]+=p[a1][b1][c1][d1]*dice[num][l];
}
}
}
}
}
}
}
else{
for(int a1=;a1>=;a1--){
for(int b1=;b1>=;b1--){
for(int c1=;c1>=;c1--){
for(int d1=;d1>=;d1--){
for(int l=;l<=(num<<);l++){
if(opt==){
if(a1+l<=)b[a1+l][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[num][l];
else b[][b1][c1][d1]+=p[a1][b1][c1][d1]*dice[num][l];
}
else if(opt==){
if(b1+l<=)b[a1][b1+l][c1][d1]+=p[a1][b1][c1][d1]*dice[num][l];
else b[a1][][c1][d1]+=p[a1][b1][c1][d1]*dice[num][l];
}
else if(opt==){
if(c1+l<=)b[a1][b1][c1+l][d1]+=p[a1][b1][c1][d1]*dice[num][l];
else b[a1][b1][][d1]+=p[a1][b1][c1][d1]*dice[num][l];
}
else{
if(d1+l<=)b[a1][b1][c1][d1+l]+=p[a1][b1][c1][d1]*dice[num][l];
else b[a1][b1][c1][]+=p[a1][b1][c1][d1]*dice[num][l];
}
}
}
}
}
}
}
}
else{
if(s[][]=='i')opt=;
else if(s[][]=='p')opt=;
else if(s[][]=='a')opt=;
else opt=;
if(s[][]=='+')num=s[][]-'';
else num=-(s[][]-'');
if(num<){
for(int a1=;a1<=;a1++){
for(int b1=;b1<=;b1++){
for(int c1=;c1<=;c1++){
for(int d1=;d1<=;d1++){
if(opt==){
if(a1+num>)b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1];
else b[][][][]+=p[a1][b1][c1][d1];
}
else if(opt==){
if(b1+num>)b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1];
else b[][][][]+=p[a1][b1][c1][d1];
}
else if(opt==){
if(c1+num>)b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1];
else b[][][][]+=p[a1][b1][c1][d1];
}
else{
if(d1+num>)b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1];
else b[][][][]+=p[a1][b1][c1][d1];
}
}
}
}
}
}
else{
for(int a1=;a1>=;a1--){
for(int b1=;b1>=;b1--){
for(int c1=;c1>=;c1--){
for(int d1=;d1>=;d1--){
if(opt==){
if(a1+num<=)b[a1+num][b1][c1][d1]+=p[a1][b1][c1][d1];
else b[][b1][c1][d1]+=p[a1][b1][c1][d1];
}
else if(opt==){
if(b1+num<=)b[a1][b1+num][c1][d1]+=p[a1][b1][c1][d1];
else b[a1][][c1][d1]+=p[a1][b1][c1][d1];
}
else if(opt==){
if(c1+num<=)b[a1][b1][c1+num][d1]+=p[a1][b1][c1][d1];
else b[a1][b1][][d1]+=p[a1][b1][c1][d1];
}
else{
if(d1+num<=)b[a1][b1][c1][d1+num]+=p[a1][b1][c1][d1];
else b[a1][b1][c1][]+=p[a1][b1][c1][d1];
}
}
}
}
}
}
}
for(int a1=;a1<=;a1++){
for(int b1=;b1<=;b1++){
for(int c1=;c1<=;c1++){
for(int d1=;d1<=;d1++){
p[a1][b1][c1][d1]=b[a1][b1][c1][d1];
b[a1][b1][c1][d1]=;
// printf("%d %d %d %d %lf\n",a1,b1,c1,d1,p[a1][b1][c1][d1]);
}
}
}
}
b[][][][]=p[][][][];
}
}
printf("%.2lf\n",p[][][][]*100.0);
for(int a1=;a1<=;a1++){
for(int b1=;b1<=;b1++){
for(int c1=;c1<=;c1++){
for(int d1=;d1<=;d1++){
ans[][val[][a1]]+=p[a1][b1][c1][d1];
ans[][val[][b1]]+=p[a1][b1][c1][d1];
ans[][val[][c1]]+=p[a1][b1][c1][d1];
ans[][val[][d1]]+=p[a1][b1][c1][d1];
}
}
}
}
for(int i=;i<=;i++){
for(int j=;j<=;j++){
printf("%.2lf ",ans[i][j]*100.0);
}
printf("\n");
}
return ;
}

最好不要点开,关爱眼睛

T3:

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n;
int k[],cnt[],vis[][][][];
struct node{
int d[],len;
}f[][][][],fir;
node cheng(node x,int sum){
node e;
memset(e.d,,sizeof(e.d));
e.len=x.len;
for(int i=;i<=x.len;i++){
e.d[i]+=x.d[i]*sum;
e.d[i+]+=e.d[i]/;
e.d[i]%=;
}
while(e.d[e.len+])e.len++;
return e;
}
node jia(node x,node y){
node e;
memset(e.d,,sizeof(e.d));
e.len=max(x.len,y.len);
for(int i=;i<=e.len;i++){
e.d[i]+=x.d[i]+y.d[i];
e.d[i+]+=e.d[i]/;
e.d[i]%=;
}
while(e.d[e.len+])e.len++;
return e;
}
node dfs(int x,int y,int z,int lst){
if(!x&&!y&&!z)return fir;
if(vis[x][y][z][lst])return f[x][y][z][lst];
vis[x][y][z][lst]=;
node num;
memset(num.d,,sizeof(num.d));
num.len=;
if(x){
num=jia(num,cheng(dfs(x-,y,z,),x-(lst==)));
}
if(y){
num=jia(num,cheng(dfs(x+,y-,z,),y-(lst==)));
}
if(z){
num=jia(num,cheng(dfs(x,y+,z-,),z));
}
return f[x][y][z][lst]=num;
}
int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++){
scanf("%d",&k[i]);
cnt[k[i]]++;
}
memset(fir.d,,sizeof(fir.d));
fir.len=fir.d[]=;
node ans=dfs(cnt[],cnt[],cnt[],);
for(int i=ans.len;i>=;i--){
printf("%d",ans.d[i]);
}
return ;
}

果然不想写题解了【瘫】

2019.10.26 csp-s模拟测试88 反思总结的更多相关文章

  1. 2019.10.26 CSP%您赛第三场

    \(CSP\)凉心模拟^_^ --题源\(lqx.lhc\)等各位蒟蒻 题目名称 比赛 传递消息 开关灯 源文件名 \(competition.cpp\) \(message.cpp\) \(ligh ...

  2. 2019.8.3 [HZOI]NOIP模拟测试12 C. 分组

    2019.8.3 [HZOI]NOIP模拟测试12 C. 分组 全场比赛题解:https://pan.baidu.com/s/1eSAMuXk 刚看这题觉得很难,于是数据点分治 k只有1和2两种,分别 ...

  3. 2019.8.3 [HZOI]NOIP模拟测试12 B. 数颜色

    2019.8.3 [HZOI]NOIP模拟测试12 B. 数颜色 全场比赛题解:https://pan.baidu.com/s/1eSAMuXk 数据结构学傻的做法: 对每种颜色开动态开点线段树直接维 ...

  4. 2019.8.3 [HZOI]NOIP模拟测试12 A. 斐波那契(fibonacci)

    2019.8.3 [HZOI]NOIP模拟测试12 A. 斐波那契(fibonacci) 全场比赛题解:https://pan.baidu.com/s/1eSAMuXk 找规律 找两个节点的lca,需 ...

  5. 2019.8.14 NOIP模拟测试21 反思总结

    模拟测试20的还没改完先咕着 各种细节问题=错失190pts T1大约三分钟搞出了式子,迅速码完,T2写了一半的时候怕最后被卡评测滚去交了,然后右端点没有初始化为n…但是这样还有80pts,而我后来还 ...

  6. 2019.8.1 NOIP模拟测试11 反思总结

    延迟了一天来补一个反思总结 急匆匆赶回来考试,我们这边大家的状态都稍微有一点差,不过最后的成绩总体来看好像还不错XD 其实这次拿分的大都是暴力[?],除了某些专注于某道题的人以及远程爆踩我们的某学车神 ...

  7. 2019.8.9 NOIP模拟测试15 反思总结

    日常爆炸,考得一次比一次差XD 可能还是被身体拖慢了学习的进度吧,虽然按理来说没有影响.大家听的我也听过,大家学的我也没有缺勤多少次. 那么果然还是能力问题吗……? 虽然不愿意承认,但显然就是这样.对 ...

  8. 2019/10/17 CSP模拟 总结

    T1 补票 Ticket 没什么好说的,不讲了 T2 删数字 Number 很后悔的是其实考场上不仅想出了正解的方程,甚至连优化都想到了,却因为码力不足只打了\(O(n^2)\)暴力,甚至还因为细节挂 ...

  9. 2019.10.30 csp-s模拟测试94 反思总结

    头一次做图巨的模拟题OWO 自从上一次听图巨讲课然后骗了小礼物以后一直对图巨印象挺好的233 T1: 对于XY取对数=Y*log(x) 对于Y!取对数=log(1*2*3*...*Y)=log1+lo ...

随机推荐

  1. range()函数在python3与python2中的区别

    range()函数在python3与python2中的区别 - CSDN博客 https://blog.csdn.net/weixin_37579123/article/details/8098038 ...

  2. js文件操作之——导出Excel (js-xlsx)

    前阵子跟server同学讨论一个Excel导出的需求,我说JS搞不定,需要server来做,被server同学强行打脸. 今天研究了下,尼玛,不光可以,还很强大了! 总结:经验是害人的,尤其是在发展迅 ...

  3. Git log和reflog

    1.log  log命令可以显示所有提交过的版本信息.显示信息如下: Administrator@USER-20171026MG MINGW64 ~/Desktop/lyf (master) $ gi ...

  4. 关于vlfeat做vlad编码问题

    这里是官方文档,可以自己查看 在这里,只是想记录一下,我这几天学习vlfeat 做vlad编码的过程,便于以后整理 网上涉及到vlfeat做vlad编码资料较少,而官网上例子又相对简单,主要是那几个参 ...

  5. 解析Asp.net Core中使用Session的方法

    2017年就这么悄无声息的开始了,2017年对我来说又是特别重要的一年. 元旦放假在家写了个Asp.net Core验证码登录, 做demo的过程中遇到两个小问题,第一是在Asp.net Core中引 ...

  6. JavaScript特效源码(8、其他特效)

    1.中文日期 中文日期[无须修改][共1步]] ====1.将以下代码加入HEML的<body></body>之间 <script LANGUAGE="Java ...

  7. ActiveMQ 传输协议

    配置 ActiveMQ安装目录的conf/activemq.xml中的<transportConnectors>标签之内. 配置示例 TCP(默认协议,性能相对可靠) Transmissi ...

  8. 前端基础之BOM与DOM操作

    目录 BOM操作 navigator对象 screen对象 history对象 localtion对象 弹出框 计时 setTimeout() clearTimeout() setInterval() ...

  9. 对比两个String无规律包含连续4个相同字符返回true的方法

    package com.qif.dsa.util; import java.util.ArrayList; import java.util.List; /** * @author * @Title: ...

  10. Failed to load resource: net::ERR_INSECURE_RESPONSE 问题解决记录

    项目在小米自带浏览器中出现了文件丢失.经检查发现这些链接引用全部是完整的线上url.改为相对路径问题解决. 同时消失的bug还有一个Error in event handler for runtime ...