ぬゎぁあぁぁああああああーーーーー…orz

アバター
Cr
記事: 93
登録日時: 14年前

ぬゎぁあぁぁああああああーーーーー…orz

投稿記事 by Cr » 14年前

こないだですね、JOIに参加してきたわけです。
3番目まで何とか解けていざ四問目
よし、できた!
あれ?なぜか異常終了…
答え出てる…cout
#include
using namespace std;

int n;
int k;
vector yotei(n);
int check [100][3][3]={0};
int solve(int a,int b, int i){

if(a==b){
if(b==yotei){
return 0;
}
}

if(i>=n)
return 1;
if(check[a-1][b-1]!=0)
return check[a-1][b-1];

if(yotei==0){
if(a==b){
switch (a){
case 1:
check[a-1][b-1]=(solve(b,2,i+1)+solve(b,3,i+1))%10000;
return check[a-1][b-1];
case 2:
check[a-1][b-1]=(solve(b,1,i+1)+solve(b,3,i+1))%10000;
return check[a-1][b-1];
case 3:
check[a-1][b-1]=(solve(b,1,i+1)+solve(b,2,i+1))%10000;
return check[a-1][b-1];
}
}
check[i][a-1][b-1]=(solve(b,1,i+1)+solve(b,2,i+1)+solve(b,3,i+1))%10000;
return check[i][a-1][b-1];
}

check[i][a-1][b-1]=(solve(b,yotei[i],i+1))%10000;
return check[i][a-1][b-1];
}
int main(){
for(int i=0;i> n >> k;
for(int i=0;i> a >> b;
yotei[a-1]=b;//ここですね ここ!!ヴァカめ!
}
if(yotei[0]!=0){
if (yotei[1]==0){
answer = (solve(yotei[0],1,2)+solve(yotei[0],2,2)+solve(yotei[0],3,2))%10000;
}else{
answer = solve(yotei[0],yotei[1],2)%10000;
}
}else{
if(yotei[1]==0){
answer = (solve(1,1,2)+solve(1,2,2)+solve(1,3,2)+solve(2,1,2)+solve(2,2,2)+solve(2,3,2)+solve(3,1,2)+solve(3,2,2)+solve(3,3,2))%10000;
}else{
answer =(solve(1,yotei[1],2)+solve(2,yotei[1],2)+solve(3,yotei[1],2))%10000;
}
}
cout <<answer;
return 0;
}
[/code]

コメントはまだありません。