level 5
#include<stdio.h>
#include<windows.h>
#include<stdlib.h>
int main(){
int i=0,k=1,s[3]={2};
float t;
srand((unsigned)time(NULL));
while(k){
t=rand()/32767.0;
if(t<0.5){
if(s[i]!=1){
s[0]=1;
i=0;
}
else{
s[i+1]=1;
i++;
}
}
if(t>0.5){
if(s[i]!=0){
s[0]=0;
i=0;
}else{
s[i+1]=0;
i++;
}
}
if(i==2){
printf("%d\n",k);
printf("%d %d %d\n",s[0],s[1],s[2]);
s[0]=2;
i=0;
k=0;
Sleep(500);
}
k++;
}
}
2012年04月15日 03点04分