当前位置:网站首页>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;
}
}
}
}
结果:
边栏推荐
- Daily sql-employee bonus filtering and answer rate ranking first
- 网络电话软件或迎整顿 “免费”通话须迈安全关
- Daily sql-statistics of the number of professionals (including the number of professionals is 0)
- C语言每日一练——Day02:求最小公倍数(3种方法)
- TF通过feature与label生成(特征,标签)集合,tf.data.Dataset.from_tensor_slices
- 详述MIMIC 的ICU患者检测时间信息表(十六)
- Pinduoduo api interface application example
- 【LeetCode每日一题】——844.比较含退格的字符串
- 技术分享 | 实战演练接口自动化如何处理 Form 请求?
- radix-4 FFT principle and C language code implementation
猜你喜欢
Taobao product details API interface
exness:黄金1800关口遇阻,静待美国CPI出炉
TF通过feature与label生成(特征,标签)集合,tf.data.Dataset.from_tensor_slices
Implement general-purpose, high-performance sorting and quicksort optimizations
3GPP LTE/NR信道模型
Resolved EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
Redis测试
【Pytorch】nn.ReLU(inplace=True)
A used in the study of EEG ultra scanning analysis process
tf中矩阵乘法
随机推荐
Unity底层是如何处理C#的
Unity程序员如何提升自己的能力
你是如何做好Unity项目性能优化的
【预约观看】Ambire 智能钱包 AMA 活动第四期即将举行
Internet phone software or consolidation of attack must be "free" calls security clearance
易观分析联合中小银行联盟发布海南数字经济指数,敬请期待!
微信小程序功能上新(2022.06.01~2022.08.04)
网络电话软件或迎整顿 “免费”通话须迈安全关
Taobao API common interface and acquisition method
Activity的四种状态
结合均线分析k线图的基本知识
博途PLC 1200/1500PLC ModbusTcp通信梯形图优化汇总(多服务器多从站轮询)
TF通过feature与label生成(特征,标签)集合,tf.data.Dataset.from_tensor_slices
How Unity programmers can improve their abilities
下一代 无线局域网--强健性
daily sql - user retention rate for two days
数仓开发知识总结
【Pytorch】nn.ReLU(inplace=True)
tf中自减操作;tf.assign_sub()
一张图了解JVM八大原子操作