Untitled
unknown
plain_text
2 years ago
861 B
5
Indexable
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int tournaments = Integer.parseInt(scanner.nextLine()); int totalPoints = Integer.parseInt(scanner.nextLine()); int tourPoints = 0; int won = 0; for (int i = 0; i < tournaments; i++) { String result = scanner.nextLine(); if (result.equals("W")) { tourPoints+=2000; totalPoints+=2000; won++; } else if (result.equals("F")) { tourPoints+=1200; totalPoints+=1200; } else if (result.equals("SF")) { totalPoints+=720; tourPoints+=720; } } System.out.printf("Final points: %d", totalPoints); System.out.printf("Average points: %d\n%d.00", Math.round(tourPoints / tournaments), (won/tournaments * 100)); } }
Editor is loading...