常言道“小赌怡情”。这是一个很简单的小游戏:首先由计算机给出第一个整数;然后玩家下注赌第二个整数将会比第一个数大还是小;玩家下注 t 个筹码后,计算机给出第二个数。若玩家猜对了,则系统奖励玩家 t 个筹码;否则扣除玩家 t 个筹码。注意:玩家下注的筹码数不能超过自己帐户上拥有的筹码数。当玩家输光了全部筹码后,游戏就结束。输入格式:输入在第一行给出 2 个正整数 T 和 K(≤ 100),分别是系统在初始状态下赠送给玩家的筹码数、以及需要处理的游戏次数。随后 K 行,每行对应一次游戏,顺序给出 4 个数字:n1 b t n2其中 n1 和 n2 是计算机先后给出的两个[0, 9]内的整数,保证两个数字不相等。b 为 0 表示玩家赌小,为 1 表示玩家赌大。t 表示玩家下注的筹码数,保证在整型范围内。输出格式:对每一次游戏,根据下列情况对应输出(其中 t 是玩家下注量,x 是玩家当前持有的筹码量):玩家赢,输出 Win t! Total = x.;玩家输,输出 Lose t. Total = x.;玩家下注超过持有的筹码量,输出 Not enough tokens. Total = x.;玩家输光后,输出 Game Over. 并结束程序。输入样例 1:100 48 0 100 23 1 50 15 1 200 67 0 200 8输出样例 1:Win 100! Total = 200.Lose 50. Total = 150.Not enough tokens. Total = 150.Not enough tokens. Total = 150.输入样例 2:100 48 0 100 23 1 200 15 1 200 67 0 200 8输出样例 2:Win 100! Total = 200.Lose 200. Total = 0.Game Over.codeimport java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] s = br.readLine().split(" “); int wager = Integer.parseInt(s[0].trim()); int time = Integer.parseInt(s[1].trim()); for (int i = 0; i < time; i++) { String[] sp = br.readLine().split(” “); int n1 = Integer.parseInt(sp[0].trim()); //数1 int answer = Integer.parseInt(sp[1].trim());//大小 int e = Integer.parseInt(sp[2].trim()); //赌注 int n2 = Integer.parseInt(sp[3].trim()); //数2 if (e > wager) { System.out.format(“Not enough tokens. Total = %d.\n” , wager); continue; } if ((n1 < n2 && answer == 1) || (n1 > n2 && answer == 0)) { wager += e; System.out.format(“Win %d! Total = %d.\n” , e , wager); } else { wager -= e; System.out.format(“Lose %d. Total = %d.\n” , e , wager); } if (wager == 0) { System.out.println(“Game Over.”); break; } } }}