当前位置:网站首页>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游戏排行榜的制作与优化
- CIKM 2022 AnalytiCup Competition: 联邦异质任务学习
- 接入网、承载网、核心网是什么,交换机路由器是什么、这个和网络的协议有什么关系呢?
- Depth (relay supervision)
- prometheus学习5altermanager
- Trill keyword search goods - API
- How to choose professional, safe and high-performance remote control software
- 软件测试主要做什么工作,难不难?
- 国密规范 SM2 SM3 SM4
- Douyin API interface
猜你喜欢
随机推荐
concept noun
Daily sql-employee bonus filtering and answer rate ranking first
求职简历这样写,轻松搞定面试官
go-grpc TSL认证 解决 transport: authentication handshake failed: x509 certificate relies on ... ...
docker安装mysql5.7(仅供测试使用)
1688 product interface
A used in the study of EEG ultra scanning analysis process
Taobao API interface reference
How to choose professional, safe and high-performance remote control software
js根据当天获取前几天的日期
深度监督(中继监督)
【Pytorch】nn.ReLU(inplace=True)
Pinduoduo API interface (attach my available API)
Tf中的平方,多次方,开方计算
opencv实现数据增强(图片+标签)平移,翻转,缩放,旋转
详述 MIMIC护理人员信息表(十五)
Tidb二进制集群搭建
matplotlib
2022年中国软饮料市场洞察
Redis测试









