2016-2017 ACM-ICPC Northwestern European Regional Programming Contest (NWERC 2016) 个人题解

Posted 木牌选手

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2016-2017 ACM-ICPC Northwestern European Regional Programming Contest (NWERC 2016) 个人题解相关的知识,希望对你有一定的参考价值。

 

 

  • Problem C Careful Ascent

可怜的我们被卡在了签到题上,当时用的二分来做,结果速度的左右区间写成了[0,1e32],而改成[-1e32,1e32]就通过了,哎~,怎么就没想到去改一下区间的范围呢。

下面是正常的数学解法,类似于解一元一次方程。

#include <iostream>
using namespace std;
typedef long long ll;

ll x,y,n;
ll a,b;double c;
int main(){
    cin>>x>>y>>n;
    ll sum = y;
    double X = 0;
    while (n--){
        cin>>a>>b>>c;
        sum -= (b-a);
        X += (b-a)*c;
    }
    X += sum;
    printf("%.10f\n",(double)x/X);
    return 0;
}

 

以上是关于2016-2017 ACM-ICPC Northwestern European Regional Programming Contest (NWERC 2016) 个人题解的主要内容,如果未能解决你的问题,请参考以下文章

2016-2017 ACM-ICPC CHINA-Final Solution

2016-2017 ACM-ICPC CHINA-Final 个人题解

2016-2017 ACM-ICPC Northwestern European Regional Programming Contest (NWERC 2016) 个人题解

2016-2017 ACM-ICPC Northeastern European Regional Contest (NEERC 16)

2016-2017 ACM-ICPC Asia-Bangkok Regional Contest

2016-2017 ACM-ICPC Pacific Northwest Regional Contest (Div. 1) Solution