当前位置:网站首页>1046 punches (15 points)
1046 punches (15 points)
2022-08-11 07:48:00 【Stay a bit】
题目要求:
代码:
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 A and B are equal, continue
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);
}
}
结果:
边栏推荐
- maxwell concept
- 接口测试的基础流程和用例设计方法你知道吗?
- 计算YUV文件的PSNR与SSIM
- 进制转换间的那点事
- 一张图了解JVM八大原子操作
- 详述 MIMIC护理人员信息表(十五)
- 为什么C#中对MySQL不支持中文查询
- 【LaTex-错误和异常】\verb ended by end of line.原因是因为闭合边界符没有在\verb命令所属行中出现;\verb命令的正确和错误用法、verbatim环境的用法
- Redis源码:Redis源码怎么查看、Redis源码查看顺序、Redis外部数据结构到Redis内部数据结构查看源码顺序
- Discourse 的关闭主题(Close Topic )和重新开放主题
猜你喜欢
随机推荐
6月各手机银行活跃用户较快增长,创半年新高
2022-08-09 第四小组 修身课 学习笔记(every day)
DDR4内存条电路设计
tf.cast(),reduce_min(),reduce_max()
Edge 提供了标签分组功能
SQL sliding window
Unity程序员如何提升自己的能力
4.1-支持向量机
break pad源码编译--参考大佬博客的总结
js判断图片是否存在
js根据当天获取前几天的日期
囍楽云任务源码
When MySQL uses GROUP BY to group the query, the SELECT query field contains non-grouping fields
What are the things that should be planned from the beginning when developing a project with Unity?How to avoid a huge pit in the later stage?
Edge provides label grouping functionality
技术分享 | 实战演练接口自动化如何处理 Form 请求?
求职简历这样写,轻松搞定面试官
prometheus学习5altermanager
Pytorch模型转ONNX模型
JVM学习——3——数据一致性








