其他分享
首页 > 其他分享> > Problem E. Bet

Problem E. Bet

作者:互联网

转载:https://blog.csdn.net/qq_40861916/article/details/84403731

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
long double arr[100+10];
void solve(int xx){
    int n;
    cin>>n;
    long double x,y;
    char a;
    for(int i=1;i<=n;i++){
        cin>>x>>a>>y; 
        arr[i]=x/(x+y);
    }
    sort(arr+1,arr+1+n);
    long double sum=0;
    int ans=0;
    for(int i=1;i<=n;i++){
        sum+=arr[i];
        if(sum<1) ans++;
        else break;
    }
    printf("Case #%d: %d\n",xx,ans);
}

int main(){
    int t;
    cin>>t;
    for(int i=1;i<=t;i++) solve(i);
    return 0;
}

 

标签:arr,int,double,long,ans,Problem,include,Bet
来源: https://www.cnblogs.com/Accepting/p/11625724.html