计算奖品价格标准差
import java.util.*;public class Main {public static void main(String[] args) {Scanner in = new Scanner(System.in);int n = in.nextInt();float sum=0;int total_n=0;int[] num=new int[10];float[] pri=new float[10];for (int i = 0; i <n ; i++) {num[i]=in.nextInt();pri[i]=in.nextFloat();total_n=total_n+num[i];sum=sum+num[i]*pri[i];}float aver=sum/total_n;double delta_2=0.0,delta=0.0;for (int i = 0; i <n ; i++) {delta_2+=(pri[i]-aver)*(pri[i]-aver)*num[i];}delta_2=delta_2/total_n;delta=Math.sqrt(delta_2);System.out.printf("%.2f",delta);}}