首页 > 其他 > 详细

Educational Codeforces Round 87 (Rated for Div. 2)

时间:2020-05-19 23:12:21      阅读:100      评论:0      收藏:0      [点我收藏+]

A.

技术分享图片

 

 技术分享图片

 

 

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--) {
        ll a, b, c, d;
        cin >> a >> b >> c >> d; 
        if(b >= a) {
            cout << b <<endl;
        }
        else if(c <= d) {
                cout << -1 <<endl;
        }
        else {
            ll s = (a - b) / (c - d);
            if(s * (c - d) < (a - b)) {
                s++;
            }
            cout << b + s * c << endl;
        }
    }
}

  B.贪心算法

技术分享图片

 

 技术分享图片

 

 C.计算几何简单版

技术分享图片

 

 技术分享图片

 

 

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
    int t;
    cin >> t;
    while(t--) {
        int n;
        cin >> n;
        double ans = 1.0 / tan(acos(-1) / (n * 2));
        printf("%.9f\n", ans);
    }
}

  C2.计算几何(复杂版)

技术分享图片

 

 技术分享图片

 

 

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
    int t;
    cin >> t;
    while(t--) {
        int n;
        cin >> n;
        double ans = 1.0 / (2.0 * sin(acos(-1) / (4 * n)));
        printf("%.9f\n", ans);
    }
}

  

Educational Codeforces Round 87 (Rated for Div. 2)

原文:https://www.cnblogs.com/lightac/p/12920248.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!