Advertisement
Guest User

Untitled

a guest
May 24th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int t,i,j,k;
  5. double n,max,sum,low;
  6. char ch[15];
  7. double a[7];
  8. scanf("%d",&t);
  9. for(int i=1; i<=t; i++)
  10. {
  11. sum=0.0;
  12. max=-1.0,low=11.0;
  13. scanf("%s",&ch);
  14. scanf("%lf",&n);
  15. for(j=0; j<7; j++)
  16. {
  17. scanf("%lf",&a[j]);
  18. sum=sum+a[j];
  19. if(max<=a[j])
  20. {
  21. max=a[j];
  22. }
  23. else if(low>=a[j])
  24. {
  25. low=a[j];
  26. }
  27. }
  28. sum-=max;
  29. sum-=low;
  30. sum*=n;
  31. printf("%s %.2lf\n",ch,sum);
  32. }
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement