Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:给后人一点数据上的提示

Posted by iluoer at 2016-08-07 10:08:14 on Problem 1064
In Reply To:给后人一点数据上的提示 Posted by:iluoer at 2016-08-07 10:05:34
> 而且顺便说一声,我测试了一下,下面的某几组数据不用满足也能过。说明数据库的数据还是比较水的。而且G++也是可以过的,亲测
> 4 3
> 8.02
> 7.43
> 4.57
> 5.39
> 
> >5.39
> 
> 4 2540
> 8.02
> 7.43
> 4.57
> 5.39
> 
> >0.01
> 
> 4 2542
> 8.02
> 7.43
> 4.57
> 5.39
> 
> >0.00
> 
> 
> 4 1 
> 8.02 
> 7.43 
> 4.57 
> 5.39
> 
> >8.02
> 
> 
> 1 1 1
> 
> >1
> 
> 
> AC代码如下
> 
> #include <iostream>
> #include <cstdio>
> #include <algorithm>
> #include <map>
> #include <string.h>
> 
> using namespace std;
> 
> double x;
> long long a[10005],m,n,summ = 0;
> 
> bool check(int mid){
>     long long sum = 0;
>     for(int i = 0;i < m; i++){
>         if(a[i] >= mid){
>             sum+=(a[i]/mid);
>         }
>     }
>     if(sum>=n)return true;
>     else return false;
> }
> 
> int main()
> {
>     scanf("%I64d%I64d",&m,&n);
>     for(long long i = 0; i < m;i++){
>         scanf("%lf",&x);
>         a[i] = (x+0.005)*100;
>         summ+=a[i];
>     }
>     long long l = 0,r = summ+1,mid;        //这地方R不加1不满足1 1 1这组数据,但是依旧AC,还有一组数据忘了是啥,不满足也依旧AC
>     if(n>summ){printf("0.00\n");return 0;}
>     while(l+1<r){
>         mid = (l+r)/2;
>         if(check(mid)) l = mid;
>         else r = mid;
>     }
>     printf("%.2f\n",l*1.0/100);
>     return 0;
> }
> 

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator