fork download
  1. #include <cstdio>
  2. #include <clocale>
  3.  
  4. using namespace std;
  5.  
  6. void printfcomma (int n) {
  7. if (n < 1000) {
  8. printf ("%d", n);
  9. return;
  10. }
  11. printfcomma (n/1000);
  12. printf (",%03d", n%1000);
  13. }
  14.  
  15. int main()
  16. {
  17. int T;
  18. scanf("%d", &T);
  19.  
  20. setlocale(LC_ALL, "en_US.UTF-8");
  21.  
  22. for (int t = 1; t <= T; ++t)
  23. {
  24. double total = 0, current;
  25.  
  26. for (int i = 0; i < 12; ++i)
  27. {
  28. scanf("%lf", &current);
  29. total += current;
  30. }
  31.  
  32. printf("%d $%'.2lf\n", t, total / 12.0);
  33. }
  34. }
Success #stdin #stdout 0s 3472KB
stdin
1
100.00
489.12
12454.12
1234.10
823.05
109.20
5.27
1542.25
839.18
83.99
1295.01
1.75
stdout
1 $1581.42