Educational Codeforces Round 49 (Rated for Div. 2) C. Minimum Value Rectangle

  1. problem link:http://codeforces.com/contest/1027/problem/C
  2. 先有下面的关系:
    Educational Codeforces Round 49 (Rated for Div. 2) C. Minimum Value Rectangle_第1张图片
    很明显只要a和b足够接近就可以了。

  3. AC code:

#include
using namespace std;
const int N=1e6+6;
double ans=1e18,pre;
int s[N],n,i,j,ans1,ans2;
int  main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int T;cin>>T;
    while(T--){
        cin>>n;
        for(i=1;i<=n;i++)cin>>s[i];
        sort(s+1,s+1+n);
        for(i=1,pre=-1;i<=n;i=j){
            for(j=i;s[j]==s[i]&&j<=n;j++);
            if(j-i>=4){ans=2;ans1=s[i];ans2=s[i];break;}
            if(j-i>=2&&pre>0&&pre/s[i]+s[i]/preif(j-i>=2)pre=s[i];
        }
        cout<" "<" "<" "<1e18;
    }
}

你可能感兴趣的:(模拟题目,codeforces)