#include<bits/stdc++.h>
using namespace std;intmain(){int t;scanf("%d",&t);while(t--){int n;scanf("%d",&n);float ans =0;for(int i =0;i < n;i ++){float price;int num;scanf("%f %d",&price,&num);
ans += price*num;}printf("%.2f\n",ans);}return0;}
B.
#include<bits/stdc++.h>
using namespace std;intmain(){int t;scanf("%d",&t);while(t--){int n;scanf("%d",&n);int a[n];int count =0;for(int i =0;i < n;i ++)scanf("%d",&a[i]);for(int i =0;i < n -2;i ++)for(int j = i +1;j < n -1;j ++)if(a[i]> a[j])for(int k = j +1;k < n;k ++)if(a[k]> a[j]) count ++;printf("%d\n",count);}return0;}
C.
#include<cstdio>#include<cmath>#define EPS 1e-8
using namespace std;double a[4];
bool judge(double a[],int n){if(n ==1){if(fabs(a[0]-24)<= EPS)return1;elsereturn0;}double b[4];for(int i =0; i < n-1;++i)for(int j = i+1; j < n;++j){int rem =0;for(int k =0; k < n;++k)if(k != i && k != j) b[rem++]= a[k];
b[rem]= a[i]+ a[j];if(judge(b, rem+1))return1;
b[rem]= a[i]- a[j];if(judge(b, rem+1))return1;
b[rem]= a[j]- a[i];if(judge(b, rem+1))return1;
b[rem]= a[i]* a[j];if(judge(b, rem+1))return1;if(fabs(a[j])> EPS){
b[rem]= a[i]/ a[j];if(judge(b, rem+1))return1;}if(fabs(a[i])> EPS){
b[rem]= a[j]/ a[i];if(judge(b, rem+1))return1;}}return0;}intmain(){while(~scanf("%lf%lf%lf%lf",&a[0],&a[1],&a[2],&a[3])&&(a[0]|| a[1]|| a[2]|| a[3]))judge(a,4)?printf("YES\n"):printf("NO\n");return0;}