zoukankan      html  css  js  c++  java
  • UVA

    题目链接

    题意:

    给一个周长为10000的圆,一开始有n个距离相等的点, 现在要添加m个点使其仍旧保持距离相等的状态,问最小的移动距离。

    思路:

    遍历原来的每一个点,找出离他最近的新的位置。

    #include <map>
    #include <set>
    #include <cstdio>
    #include <cstring>
    #include <algorithm>
    #include <queue>
    #include <iostream>
    #include <stack>
    #include <cmath>
    #include <string>
    #include <vector>
    #include <cstdlib>
    //#include <bits/stdc++.h>
    //#define LOACL
    #define space " "
    using namespace std;
    //typedef long long LL;
    typedef __int64 Int;
    typedef pair<int, int> paii;
    const int INF = 0x3f3f3f3f;
    const double ESP = 1e-5;
    const double PI = acos(-1.0);
    const int MAXN = 100 + 10;
    int main() {
        int n, m;
        while (scanf("%d%d", &n, &m) != EOF) {
            double ans = 0;
            double l = 360.0/(n + m);
            for (int i = 0; i < n; i++) {
                double temp = 360.0/n * i;
                double x = temp/l;
                ans += min(abs(temp - x*l), abs(x*l+l-temp))/360.0*100;
            }
            printf("%.6lf
    ", ans);
        }
        return 0;
    }



  • 相关阅读:
    将.lib库文件转换成.a库文件的工具
    协议
    协议
    bzoj1066
    bzoj2668
    bzoj2245
    bzoj2324后续思考
    bzoj2324
    jsoi2014前两轮回眸
    bzoj1293
  • 原文地址:https://www.cnblogs.com/cniwoq/p/6770771.html
Copyright © 2011-2022 走看看