当前位置:网站首页>1071 Small Gamble (15 points)
1071 Small Gamble (15 points)
2022-08-11 07:48:00 【dumb bit】
题目要求:
代码:
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;
}
}
}
}
结果:
边栏推荐
猜你喜欢
随机推荐
When MySQL uses GROUP BY to group the query, the SELECT query field contains non-grouping fields
1036 跟奥巴马一起编程 (15 分)
深度监督(中继监督)
js根据当天获取前几天的日期
囍楽云任务源码
matplotlib
【软件测试】(北京)字节跳动科技有限公司二面笔试题
Unity3D learning route?
CIKM 2022 AnalytiCup Competition: 联邦异质任务学习
TF中的One-hot
恒源云-Pycharm远程训练避坑指南
3.1-分类-概率生成模型
oracle19c不支持实时同步参数,请教一下大佬们有什么好的解决办法吗?
Edge 提供了标签分组功能
STM32CUBEIDE(11)----输出PWM及修改PWM频率与占空比
Redis source code: how to view the Redis source code, the order of viewing the Redis source code, the sequence of the source code from the external data structure of Redis to the internal data structu
【LeetCode每日一题】——844.比较含退格的字符串
TF中使用softmax函数;
项目2-年收入判断
数仓开发知识总结