【郑轻】[1758]Stone scissors and cloth

文章字数:165

问题描述

问题分析

让我想到了我的机器人~
哈哈哈
不过这个写的也是毫无亮点的麻烦……

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<stdio.h>
int jd(int a,int b);
int main() {
	int a[3],x[3];
	int i,na,nx;
	while(scanf("%d %d %d %d %d %d",&a[0],&a[1],&a[2],&x[0],&x[1],&x[2])!=EOF) {
		for(i=0,na=0,nx=0; i<3; i++) {
			if(jd(a[i],x[i])==1)
				na++;
			if(jd(a[i],x[i])==2)
				nx++;
		}
		if(na>nx)
			printf("dml is the winner\n");
		else if(na<nx)
			printf("zy is the winner\n");
		else
			printf("no winner\n");
	}
	return 0;
}
int jd(int a,int b) {
	if(a==1&&b==3)
		return 2;
	else if(a==3&&b==1)
		return 1;
	else if(a<b)
		return 1;
	else if(a>b)
		return 2;
	else
		return 0;
}

题目地址:【郑轻】[1758]Stone scissors and cloth

该内容采用 CC BY-NC-SA 4.0 许可协议。

如果对您有帮助或存在意见建议,欢迎在下方评论交流。

加载中...