Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Above Average
SUBMITTED BY:
Guest
DATE:
Dec. 5, 2013, 3:18 p.m.
FORMAT:
C++
SIZE:
577 Bytes
Raw
Download
Tweet
HITS:
853
Go to comments
Report
#include
<stdio.h>
int
main
()
{
int
kase
,
n
,
i
;
float
avg
,
res
,
sum
,
cnt
;
float
arr
[
1005
];
scanf
(
"%d"
,
&
kase
);
char
c
=
'%'
;
while
(
kase
--
)
{
avg
=
0
;
sum
=
0
;
cnt
=
0
;
scanf
(
"%d"
,
&
n
);
for
(
i
=
0
;
i
<
n
;
i
++
)
scanf
(
"%f"
,
&
arr
[
i
]);
for
(
i
=
0
;
i
<
n
;
i
++
)
sum
=
sum
+
arr
[
i
];
avg
=
(
sum
/
n
);
for
(
i
=
0
;
i
<
n
;
i
++
)
if
(
arr
[
i
]
>
avg
)
cnt
++
;
res
=
((
cnt
/
n
)
*
100
);
printf
(
"%.3f%c
\n
"
,
res
,
c
);
}
return
0
;
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus