Questions algorithms to improve the singing contest
Resource constraints
Time limit: 1.0s memory limit: 256.0MB
Problem Description
City X being a singing contest, please write a program to calculate the score.
Each player numbers from 1 to N, each player's overall score consists of the following components:
1. Singing Score 70%
2. talent show score 20%
3. 10% of the audience voting score
4. The special points does not exceed a fifth (if more than 100 points out of 100 is referred to as)
the input format
of the first line of an integer N, the number of players
Next N lines of four integers, each represent singing score, score talent, the vote score and the score.
Output format
output N lines, each a number representing the score (to one decimal place)
sample input
. 6
62 is. 1 50 60
77 71 is 85. 3
98. 5 79 98
75 0 60 62 is
99. 4 72 68
82 2 88 89
Sample Output
60.4
79.6
99.2
70.9
94.5
85.9
data size and conventions
N <= 10000;
import java.util.Scanner;
public class 歌唱比赛 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i=0;i<n;i++){
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int d = sc.nextInt();
double num1=a*0.7+b*0.2+c*0.1;
double num2 = num1+d;
System.out.printf("%.1f\n",num2>100.0?100.0:num2);
}
}
}