Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
974 yy023 果壳游戏 C++ 通过 0 MS 252 KB 543 2022-05-28 10:00:14

Tests(10/10):


#include <iostream> using namespace std; void swap(int*,int*); int main(){ int koker[3]; int n,score,max=0; cin>>n; int a[n],b[n],c[n]; for(int i=0;i<n;i++)cin>>a[i]>>b[i]>>c[i]; for (int g=0;g<3;g++){ for(int i=0;i<3;i++)koker[i]=0; score=0; koker[g]=1; for(int i=0;i<n;i++){ swap(&(koker[a[i]-1]),&(koker[b[i]-1])); if(koker[c[i]-1]==1)score++; } max=max>score?max:score; } cout<<max; return 0; } void swap(int* a,int* b){ int t=*a; *a=*b; *b=t; }


测评信息: