C++

Timeloop 发表于 1年前 · 关联问题 球魁

include

using namespace std;

int score(int);

int main(){

int n; int r; int lwh; int lzh; int sl; cin>>r>>n; if(n%2==0)lzh=r/2; else lzh=r/2+1; lwh=r-lzh; sl=score(lwh); if(sl>lzh*2)cout<<"lwh wins."; else if(sl<lzh*2)cout<<"lzh wins."; else cout<<"equal."; return 0;

}

int score(int lwh){

int score=0; int l; for(int i=0;i<lwh;i++){ cin>>l; if(l==15); else if(l==11)score+=3; else { for(int m=2;m<=l/m;m++){ if(l%m==0&&l!=2)l=1; } if(l==1)score++; else score+=2; } } return score;

}