Created
October 24, 2017 22:51
-
-
Save codyhex/3b0f4bc49a3a2287793ad6cf530b118e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using namespace std; | |
| int main() { | |
| int n; | |
| cin >> n; | |
| double pl = 0, mn = 0, zr = 0; | |
| for (int i = 0; i < n; i++) { | |
| int val; | |
| cin >> val; | |
| zr += (val == 0); | |
| pl += (val > 0); | |
| mn += (val < 0); | |
| } | |
| zr = zr / (double)n; | |
| pl = pl / (double)n; | |
| mn = mn / (double)n; | |
| // prints 0.123456 | |
| printf("%0.06lf\n%0.06lf\n%0.06lf\n", pl, mn, zr); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment