当前位置:网站首页>1071 小赌怡情 (15 分)
1071 小赌怡情 (15 分)
2022-08-11 06:46:00 【呆比特】
题目要求:
代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int k = sc.nextInt();
sc.nextLine();
for (int i = 0; i < k; i++) {
String[] s = sc.nextLine().split(" ");
if (t < Integer.valueOf(s[2])){
System.out.println("Not enough tokens. Total = "+ t +".");
}else{
int flag = Integer.valueOf(s[0]) < Integer.valueOf(s[3]) ? 1 : 0;
if (flag == Integer.valueOf(s[1])){
t += Integer.valueOf(s[2]);
System.out.println("Win "+ Integer.valueOf(s[2]) +"! Total = "+ t +".");
} else {
t -= Integer.valueOf(s[2]);
System.out.println("Lose "+ Integer.valueOf(s[2]) +". Total = "+ t +".");
}
}
if (t == 0){
System.out.println("Game Over.");
break;
}
}
}
}
结果:
边栏推荐
- 从苹果、SpaceX等高科技企业的产品发布会看企业产品战略和敏捷开发的关系
- TF中的条件语句;where()
- NTT的Another Me技术助力创造歌舞伎演员中村狮童的数字孪生体,将在 “Cho Kabuki 2022 Powered by NTT”舞台剧中首次亮相
- Edge 提供了标签分组功能
- 网络电话软件或迎整顿 “免费”通话须迈安全关
- 【Pytorch】nn.ReLU(inplace=True)
- Resolved EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
- Taobao API common interface and acquisition method
- tf.cast(),reduce_min(),reduce_max()
- 李沐d2l(十)--卷积层Ⅰ
猜你喜欢
Multiscale communication in cortical-cortical networks
基于FPGA的FIR滤波器的实现(5)— 并行结构FIR滤波器的FPGA代码实现
Trill keyword search goods - API
囍楽云任务源码
Pico neo3 Unity打包设置
Implementation of FIR filter based on FPGA (5) - FPGA code implementation of parallel structure FIR filter
MySQL 版本升级心得
NFT 的价值从何而来
公牛10-11德里克·罗斯最强赛季记录
mysql视图与索引
随机推荐
CIKM 2022 AnalytiCup Competition: 联邦异质任务学习
Edge 提供了标签分组功能
线程交替输出(你能想出几种方法)
接入网、承载网、核心网是什么,交换机路由器是什么、这个和网络的协议有什么关系呢?
Activity的四种启动模式
JVM学习——3——数据一致性
公牛10-11德里克·罗斯最强赛季记录
ROS 话题通信理论模型
关于Android Service服务的面试题
Depth (relay supervision)
进制转换间的那点事
【LaTex-错误和异常】\verb ended by end of line.原因是因为闭合边界符没有在\verb命令所属行中出现;\verb命令的正确和错误用法、verbatim环境的用法
Unity程序员如何提升自己的能力
Resolved EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
【预约观看】Ambire 智能钱包 AMA 活动第四期即将举行
Pico neo3 Unity打包设置
联想集团:2022/23财年第一季度业绩
Multiscale communication in cortical-cortical networks
为什么C#中对MySQL不支持中文查询
Find the shops that have sold more than 1,000 yuan per day for more than 30 consecutive days in the past six months