Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Easter_competition {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int breads = Integer.parseInt(scanner.nextLine());
- int maxScore = 0;
- String winner = "";
- for (int i = 0; i < breads ; i++) {
- String name = scanner.nextLine();
- int currentScoreCount = 0;
- String currentWinner = "";
- while (!"Stop".equals(name)){
- int score = Integer.parseInt(scanner.nextLine());
- currentScoreCount += score;
- if (currentScoreCount > maxScore) {
- maxScore = currentScoreCount;
- currentWinner = winner;
- }
- name = scanner.nextLine();
- }
- System.out.printf("%s has %d points.", currentWinner, currentScoreCount);
- // if(currentScoreCount >= maxScore) {
- // winner = currentWinner;
- // System.out.printf("%s is the new number 1!", winner);
- //
- // }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement