当前位置:网站首页>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);
}
}
结果:
边栏推荐
- Resolved EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
- radix-4 FFT principle and C language code implementation
- 年薪40W测试工程师成长之路,你在哪个阶段?
- Unity3D learning route?
- 详述MIMIC 的ICU患者检测时间信息表(十六)
- tf.reduce_mean()与tf.reduce_sum()
- 【LeetCode每日一题】——682.棒球比赛
- C语言每日一练——Day02:求最小公倍数(3种方法)
- linux 安装mysql服务报错
- Taobao API interface reference
猜你喜欢
Pinduoduo API interface (attach my available API)
How to choose professional, safe and high-performance remote control software
公牛10-11德里克·罗斯最强赛季记录
Douyin get douyin share password url API return value description
JD.com product details API call example explanation
ROS 话题通信理论模型
MySQL 版本升级心得
PIXHAWK飞控使用RTK
【@网络工程师:用好这6款工具,让你的工作效率大翻倍!】
数仓开发知识总结
随机推荐
公牛10-11德里克·罗斯最强赛季记录
计算YUV文件的PSNR与SSIM
pytorch,numpy两种方法实现nms类间+类内
tf.cast(),reduce_min(),reduce_max()
Daily SQL - find each of the students school gpa minimum (window)
下一代 无线局域网--强健性
Trill keyword search goods - API
3GPP LTE/NR信道模型
6月各手机银行活跃用户较快增长,创半年新高
JVM学习——3——数据一致性
2022-08-09 Group 4 Self-cultivation class study notes (every day)
LeetCode brushing series -- 46. Full arrangement
关于Android Service服务的面试题
软件测试主要做什么工作,难不难?
STM32CUBEIDE(11)----输出PWM及修改PWM频率与占空比
Discourse's Close Topic and Reopen Topic
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?
【@网络工程师:用好这6款工具,让你的工作效率大翻倍!】
Pytorch模型转ONNX模型
2022年中国软饮料市场洞察