每日一练10
来源:互联网 发布:dnf易语言脚本源码 编辑:程序博客网 时间:2024/05/21 16:50
题目:两个乒乓球队进行比赛,各出三人。甲队为a,b,c三人,乙队为x,y,z三人。已抽签决定比赛名单。有人向队员打听比赛的名单。a说他不和x比,c说他不和x,z比,请编程序找出三队赛手的名单。
public static void test7(){
int a = 1;
int b = 2;
int c = 3;
for(int x = a; x <= c ; x++){
if(x == a || x == c){
continue;
}
for(int y = a; y <= c; y++){
if(y == x){
continue;
}
for(int z = a; z <= c; z++){
if( z == c || z == x || z == y){
continue;
}
if(x != y && x != z && y !=z){
System.out.println("x的对手是第"+x+"位");
System.out.println("y的对手是第"+y+"位");
System.out.println("z的对手是第"+z+"位");
break;
}
}
}
}
}
int a = 1;
int b = 2;
int c = 3;
for(int x = a; x <= c ; x++){
if(x == a || x == c){
continue;
}
for(int y = a; y <= c; y++){
if(y == x){
continue;
}
for(int z = a; z <= c; z++){
if( z == c || z == x || z == y){
continue;
}
if(x != y && x != z && y !=z){
System.out.println("x的对手是第"+x+"位");
System.out.println("y的对手是第"+y+"位");
System.out.println("z的对手是第"+z+"位");
break;
}
}
}
}
}
阅读全文
0 0
- 每日一练10
- 每日一练-10
- 每日一练10月26日
- 2017-10-30每日一练
- 每日一练2017-10-30
- 2017-10-31每日一练
- 算法每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- 每日一练
- Spring思维导图,让Spring不再难懂(cache篇)
- maven中setting.xml的阿里云aliyun镜像配置
- 数学学习的网址【更新】
- Rv+ok+Fresco+mvp
- 自制工具jar包
- 每日一练10
- 在名为商品库的数据库中包含有商品规格表Content和商品特性表Property
- html中a链接的javascript确认框
- 测试
- 单调队列优化动态规划
- Ajax中POST和GET的区别
- 虚拟机执行命令提示 : Redirecting to /bin/systemctl restart sshd.service
- div中添加多张img图片,点击img跳转页面查看大图
- 每日一练11