当前位置:网站首页>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);
}
}
结果:
边栏推荐
- 求职简历这样写,轻松搞定面试官
- Redis + lua implements distributed interface current limiting implementation scheme
- 1003 我要通过 (20 分)
- cdc连sqlserver异常对象可能有无法序列化的字段 有没有大佬看得懂的 帮忙解答一下
- pytorch,numpy两种方法实现nms类间+类内
- 易观分析联合中小银行联盟发布海南数字经济指数,敬请期待!
- Strongly recommend an easy-to-use API interface
- DDR4内存条电路设计
- Go语言实现Etcd服务发现(Etcd & Service Discovery & Go)
- Unity程序员如何提升自己的能力
猜你喜欢
Daily sql-employee bonus filtering and answer rate ranking first
Redis源码:Redis源码怎么查看、Redis源码查看顺序、Redis外部数据结构到Redis内部数据结构查看源码顺序
A used in the study of EEG ultra scanning analysis process
Douyin API interface
tf中自减操作;tf.assign_sub()
Taobao API common interface and acquisition method
NFT 的价值从何而来
Strongly recommend an easy-to-use API interface
【推荐系统】:协同过滤和基于内容过滤概述
技能在赛题解析:交换机防环路设置
随机推荐
网络电话软件或迎整顿 “免费”通话须迈安全关
Shell:三剑客之awk
Service的两种状态形式
Coordinate system in navigation and positioning
6月各手机银行活跃用户较快增长,创半年新高
基于FPGA的FIR滤波器的实现(4)— 串行结构FIR滤波器的FPGA代码实现
一张图了解JVM八大原子操作
ROS 话题通信理论模型
Pico neo3在Unity中的交互操作
cdc连sqlserver异常对象可能有无法序列化的字段 有没有大佬看得懂的 帮忙解答一下
Tidb二进制集群搭建
Implementation of FIR filter based on FPGA (5) - FPGA code implementation of parallel structure FIR filter
radix-4 FFT principle and C language code implementation
MindManager2022全新正式免费思维导图更新
DDR4内存条电路设计
Taobao API interface reference
Strongly recommend an easy-to-use API interface
Unity底层是如何处理C#的
JD.com product details API call example explanation
Get Pinduoduo product information operation details