Untitled

 avatar
unknown
plain_text
2 years ago
957 B
15
Indexable
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String actor = sc.nextLine();
        double points = Double.parseDouble(sc.nextLine());
        int n = Integer.parseInt(sc.nextLine());
        double total = 0 + points;
        
        for (int i = 1; i <=n; i++) {
            String evaluator = sc.nextLine();
            double evaluatorPoints = Double.parseDouble(sc.nextLine());
            total = total + evaluatorPoints * evaluator.length() / 2.;
            if (total > 1250.5) {
                System.out.printf("Congratulations, %s got a nominee for leading role with %.1f!", actor, total);
                break;
            }
        }
        
        if (total < 1250.5) {
             double diff = 1250.5 - total;
            System.out.printf("Sorry, %s you need %.1f more!", actor, diff);
        }
       
    }
}
Editor is loading...