当前位置:网站首页>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);
}
}
结果:
边栏推荐
猜你喜欢
go-grpc TSL认证 解决 transport: authentication handshake failed: x509 certificate relies on ... ...
求职简历这样写,轻松搞定面试官
Amazon API interface Daquan
1071 小赌怡情 (15 分)
如何选择专业、安全、高性能的远程控制软件
3.2-分类-Logistic回归
语音信号处理:预处理【预加重、分帧、加窗】
TF通过feature与label生成(特征,标签)集合,tf.data.Dataset.from_tensor_slices
4.1-支持向量机
1106 2019数列 (15 分)
随机推荐
TF通过feature与label生成(特征,标签)集合,tf.data.Dataset.from_tensor_slices
Unity开发者必备的C#脚本技巧
CIKM 2022 AnalytiCup Competition: 联邦异质任务学习
MindManager2022全新正式免费思维导图更新
Activity的四种状态
你是如何做好Unity项目性能优化的
Tensorflow中使用tf.argmax返回张量沿指定维度最大值的索引
DDR4内存条电路设计
【Pytorch】nn.Linear,nn.Conv
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?
Pytorch模型转ONNX模型
基于FPGA的FIR滤波器的实现(4)— 串行结构FIR滤波器的FPGA代码实现
MySQL 版本升级心得
SQL sliding window
为什么C#中对MySQL不支持中文查询
When MySQL uses GROUP BY to group the query, the SELECT query field contains non-grouping fields
SQL滑动窗口
恒源云-Pycharm远程训练避坑指南
软件测试主要做什么工作,难不难?
Shell:三剑客之awk