uva 3708

来源:互联网 发布:淘宝运营加薪申请 编辑:程序博客网 时间:2024/06/08 14:16
#include <iostream>#include <cstdio>#include <cmath>using namespace std;int main(){int m, n;while(scanf("%d %d", &m, &n) == 2){double tot = 0.0;for(int i = 1; i <=m; i++){double pos = ((double)i/m)*(m + n);tot += fabsf(pos - floor(pos + 0.5))/(m+n);}printf("%.4lf\n", tot*10000);}return 0;}

原创粉丝点击