当前位置:网站首页>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;
}
}
}
}
结果:
边栏推荐
- Unity程序员如何提升自己的能力
- Depth (relay supervision)
- docker安装mysql5.7(仅供测试使用)
- daily sql - query for managers and elections with at least 5 subordinates
- 深度监督(中继监督)
- 【latex异常和错误】Missing $ inserted.<inserted text>You can‘t use \spacefactor in math mode.输出文本要注意特殊字符的转义
- Multiscale communication in cortical-cortical networks
- Daily sql--statistics the total salary of employees in the past three months (excluding the latest month)
- Unity底层是如何处理C#的
- Shell:三剑客之awk
猜你喜欢
【推荐系统】:协同过滤和基于内容过滤概述
Coordinate system in navigation and positioning
【@网络工程师:用好这6款工具,让你的工作效率大翻倍!】
【Pytorch】nn.PixelShuffle
Pico neo3 Unity打包设置
技术分享 | 实战演练接口自动化如何处理 Form 请求?
Douyin API interface
Redis源码:Redis源码怎么查看、Redis源码查看顺序、Redis外部数据结构到Redis内部数据结构查看源码顺序
Douyin API interface
When MySQL uses GROUP BY to group the query, the SELECT query field contains non-grouping fields
随机推荐
伦敦银规则有哪些?
linux 安装mysql服务报错
Resolved EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
TF中的条件语句;where()
tf.reduce_mean()与tf.reduce_sum()
2022年中国软饮料市场洞察
详述 MIMIC护理人员信息表(十五)
关于Android Service服务的面试题
【软件测试】(北京)字节跳动科技有限公司二面笔试题
Activity的四种启动模式
从 dpdk-20.11 移植 intel E810 百 G 网卡 pmd 驱动到 dpdk-16.04 中
DDR4内存条电路设计
Edge 提供了标签分组功能
Pytorch模型转ONNX模型
李沐d2l(十)--卷积层Ⅰ
tf.cast(),reduce_min(),reduce_max()
Daily sql--statistics the total salary of employees in the past three months (excluding the latest month)
Implement general-purpose, high-performance sorting and quicksort optimizations
Redis测试
线程交替输出(你能想出几种方法)