Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int win = 0, lost = 0;
- String tournament;
- while (!(tournament = scanner.nextLine()).equals("End of tournaments")) {
- int games = Integer.parseInt(scanner.nextLine());
- for (int game = 1; game <= games; game++) {
- int team1 = Integer.parseInt(scanner.nextLine());
- int team2 = Integer.parseInt(scanner.nextLine());
- if (team1 > team2) {
- System.out.printf("Game %d of tournament %s: win with %d points.\n", game, tournament, team1 - team2);
- win++;
- } else {
- System.out.printf("Game %d of tournament %s: lost with %d points.\n", game, tournament, team2 - team1);
- lost++;
- }
- }
- }
- System.out.printf("%.2f%% matches win\n", 1.0 * win / (win + lost) * 100);
- System.out.printf("%.2f%% matches lost\n", 1.0 * lost / (win + lost) * 100);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement