当前位置:网站首页>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);
}
}
结果:
边栏推荐
- 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?
- 1036 跟奥巴马一起编程 (15 分)
- buu—Re(5)
- 求职简历这样写,轻松搞定面试官
- golang fork 进程的三种方式
- 网络电话软件或迎整顿 “免费”通话须迈安全关
- Unity3D 学习路线?
- 微信小程序功能上新(2022.06.01~2022.08.04)
- Service的两种状态形式
- 1002 写出这个数 (20 分)
猜你喜欢
随机推荐
Internet phone software or consolidation of attack must be "free" calls security clearance
博途PLC 1200/1500PLC ModbusTcp通信梯形图优化汇总(多服务器多从站轮询)
Amazon API interface Daquan
1106 2019数列 (15 分)
从何跟踪伦敦金最新行情走势?
Douyin API interface
tf中矩阵乘法
关于Excel实现分组求和最全文档
go-grpc TSL认证 解决 transport: authentication handshake failed: x509 certificate relies on ... ...
2022-08-09 Group 4 Self-cultivation class study notes (every day)
How to choose professional, safe and high-performance remote control software
为什么C#中对MySQL不支持中文查询
jar服务导致cpu飙升问题-带解决方法
TF中的One-hot
Pytorch模型转ONNX模型
Activity的四种启动模式
接口测试的基础流程和用例设计方法你知道吗?
STM32CUBEIDE(11)----输出PWM及修改PWM频率与占空比
项目2-年收入判断
Service的两种状态形式









