当前位置:网站首页>1046 划拳 (15 分)
1046 划拳 (15 分)
2022-08-11 06:46:00 【呆比特】
题目要求:
代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//輸入
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
scanner.nextLine();
int a = 0, b = 0;
for (int i = 0; i < n; i++){
String line = scanner.nextLine();
String[] split = line.split(" ");
int r = Integer.valueOf(split[0]) + Integer.valueOf(split[2]);
//甲乙相等则继续
if (Integer.valueOf(split[1]) == Integer.valueOf(split[3])) continue;
//喝酒
if (r == Integer.valueOf(split[1]) ){
b += 1;
}else if (r == Integer.valueOf(split[3])){
a += 1;
}
}
System.out.println(a + " " + b);
}
}
结果:
边栏推荐
- 【软件测试】(北京)字节跳动科技有限公司二面笔试题
- 公牛10-11德里克·罗斯最强赛季记录
- 技术分享 | 实战演练接口自动化如何处理 Form 请求?
- ROS 服务通信理论模型
- pytorch,numpy两种方法实现nms类间+类内
- Daily sql-employee bonus filtering and answer rate ranking first
- 机器学习总结(二)
- 1688 product interface
- Daily sql-statistics of the number of professionals (including the number of professionals is 0)
- 进制转换间的那点事
猜你喜欢

常见激活函数及其导数

Strongly recommend an easy-to-use API interface

第一个C函数:如何实现板级初始化?

When MySQL uses GROUP BY to group the query, the SELECT query field contains non-grouping fields

Douyin get douyin share password url API return value description

SQL滑动窗口

【软件测试】(北京)字节跳动科技有限公司二面笔试题

【latex异常和错误】Missing $ inserted.<inserted text>You can‘t use \spacefactor in math mode.输出文本要注意特殊字符的转义

Coordinate system in navigation and positioning

NFT 的价值从何而来
随机推荐
Edge 提供了标签分组功能
concept noun
Amazon API interface Daquan
exness:黄金1800关口遇阻,静待美国CPI出炉
Resolved EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
2021-08-11 for循环结合多线程异步查询并收集结果
A used in the study of EEG ultra scanning analysis process
daily sql - query for managers and elections with at least 5 subordinates
Tidb二进制集群搭建
2022-08-10 Group 4 Self-cultivation class study notes (every day)
Trill keyword search goods - API
数仓开发知识总结
你是如何做好Unity项目性能优化的
Activity的四种启动模式
1688 product interface
jar服务导致cpu飙升问题-带解决方法
微信小程序功能上新(2022.06.01~2022.08.04)
【LeetCode每日一题】——844.比较含退格的字符串
易观分析联合中小银行联盟发布海南数字经济指数,敬请期待!
C语言每日一练——Day02:求最小公倍数(3种方法)