当前位置:网站首页>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;
}
}
}
}
结果:
边栏推荐
猜你喜欢
随机推荐
【@网络工程师:用好这6款工具,让你的工作效率大翻倍!】
从苹果、SpaceX等高科技企业的产品发布会看企业产品战略和敏捷开发的关系
PIXHAWK飞控使用RTK
How to choose professional, safe and high-performance remote control software
3.2-分类-Logistic回归
博途PLC 1200/1500PLC ModbusTcp通信梯形图优化汇总(多服务器多从站轮询)
TF中的One-hot
Activity的四种状态
TF通过feature与label生成(特征,标签)集合,tf.data.Dataset.from_tensor_slices
tf中自减操作;tf.assign_sub()
Resolved EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
Redis source code-String: Redis String command, Redis String storage principle, three encoding types of Redis string, Redis String SDS source code analysis, Redis String application scenarios
maxwell concept
2022年中国软饮料市场洞察
js根据当天获取前几天的日期
A used in the study of EEG ultra scanning analysis process
为什么我使用C#操作MySQL进行中文查询失败
[Recommender System]: Overview of Collaborative Filtering and Content-Based Filtering
Douyin API interface
tf中矩阵乘法









