Skip to content

Instantly share code, notes, and snippets.

@cbdavide
Created October 4, 2018 22:52
Show Gist options
  • Save cbdavide/7009118b83f005fa7e1b3d95572910a1 to your computer and use it in GitHub Desktop.
Save cbdavide/7009118b83f005fa7e1b3d95572910a1 to your computer and use it in GitHub Desktop.
UVA 10491 - Cows and Cars
#include <bits/stdc++.h>
using namespace std;
int main() {
int v, c, o, n;
while(scanf("%d %d %d\n", &v, &c, &o) == 3) {
n = c + v;
double answ = (c * (c - 1)) / (n * (n - o - 1) * 1.0);
answ += (c * v * 1.0) / (n * (n - o - 1));
printf("%.5f\n", answ);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment