Codeforce 605BE. Freelancer ' s Dreams

Source: Internet
Author: User

Test instructions: give you n a project, do each project corresponding growth x experience and y money. Ask how many days you need to arrive at least to set goals. The time can be a floating-point number.

Train of thought: the idea of du teaching, with dual principle is very simple. Personal advice is also a standard solution, convex hull + linear combination.

1#include <iostream>2#include <string>3#include <algorithm>4#include <cstdlib>5#include <cstdio>6#include <Set>7#include <map>8#include <vector>9#include <cstring>Ten#include <stack> One#include <cmath> A#include <queue> -#include <bits/stdc++.h> - using namespacestd; the #defineCL (X,V); memset (x,v,sizeof (x)); - #defineINF 0x3f3f3f3f - #defineLL Long Long - Const intSigma_size = -; + Const intMaxnode =111000; - Const intMaxs = Max+Ten; + Const intMAXN = 1e5+Ten; A intA[MAXN], B[MAXN]; at intN, p, q; -  - DoubleFDoublex) - { -     Doubley =1; -      for(intI=0; i<n;i++) y = min (Y, (1.0-x*b[i])/a[i]); in     returnY*p + x*Q; - } to  + intMain () - { theCIN >> n >> P >>Q; *      for(intI=0; i<n;i++) cin >> A[i] >>B[i]; $     DoubleL=0, r =1./(*max_element (b, + +n));Panax Notoginseng      for(intI=0;i< $; i++) -     { the         Doublell = (l+l+r)/3, rr = (R + r+l)/3; +         if(f (LL) > F (RR)) R =RR; A         ElseL =ll; the     } +printf"%.10f\n", F ((l+r) *0.5)); -     return 0; $}
View Code

Codeforce 605BE. Freelancer ' s Dreams

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.