#include<bits/stdc++.h>
using namespace std;
int main()
{
int t, i, j = 1;
cin >> t;
while(t--)
{
double a[12], sum = 0;
for(i=0; i<12; i++)
{
cin >> a[i];
sum = sum + a[i];
}
sum = sum/12;
int s = sum/1000, f;
if(s == 0)
f = -1;
else if(s > 9)
f = 2;
else
f = 1;
string st = to_string(sum);
cout << j++ << " $";
for(i=0; i<st.size(); i++)
{
if(i == f)
cout << ",";
if(st[i] == '.')
{
cout << st[i];
int p3 = st[i+3] - '0', p2 = st[i+2] - '0', p1 = st[i+1] - '0';
if(p3 >= 5)
{
p2++;
if(p2 == 10)
{
p1++;
p2 = 0;
}
}
cout << p1 << p2 << "\n";
break;
}
cout << st[i];
}
}
return 0;
}
using namespace std;
int main()
{
int t, i, j = 1;
cin >> t;
while(t--)
{
double a[12], sum = 0;
for(i=0; i<12; i++)
{
cin >> a[i];
sum = sum + a[i];
}
sum = sum/12;
int s = sum/1000, f;
if(s == 0)
f = -1;
else if(s > 9)
f = 2;
else
f = 1;
string st = to_string(sum);
cout << j++ << " $";
for(i=0; i<st.size(); i++)
{
if(i == f)
cout << ",";
if(st[i] == '.')
{
cout << st[i];
int p3 = st[i+3] - '0', p2 = st[i+2] - '0', p1 = st[i+1] - '0';
if(p3 >= 5)
{
p2++;
if(p2 == 10)
{
p1++;
p2 = 0;
}
}
cout << p1 << p2 << "\n";
break;
}
cout << st[i];
}
}
return 0;
}
Comments
Post a Comment