QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#501249 | #5152. Circular Caramel Cookie | Original3080up | WA | 0ms | 3748kb | C++17 | 2.1kb | 2024-08-02 16:03:15 | 2024-08-02 16:03:15 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;
int check1(int mid)
{
int res= mid* (mid+4);
if(n>res) return 1;
else return 0;
}
int check2(int mid)
{
int res= mid*mid;
if(n>res) return 1;
else return 0;
}
int check3(int mid)
{
int res= mid*(mid+1);
if(n>res) return 1;
else return 0;
}
bool cmp(pair<int,pair <int ,int >> a,pair<int,pair <int ,int > > b)
{
if(a.second.first== b.second.first)
return a.second.second < b.second.second;
else return a.second.first < b.second.first;
}
signed main()
{
cin>>n;
int l=0,r=1e5;
while(l+1<r)
{
int mid=l+r>>1;
if(check1(mid)) l=mid;
else r=mid;
}
//cout<<l <<' '<<r<<endl;
int nowl=l,nowr=r;
l=0,r=1e5;
while(l+1<r)
{
int mid=l+r>>1;
if(check2(mid)) l=mid;
else r=mid;
}
int nxtl=l,nxtr=r;
l=0,r=1e5;
while(l+1<r)
{
int mid=l+r>>1;
if(check3(mid)) l=mid;
else r=mid;
}
int snowl=l,snowr=r;
vector < pair<int, pair< int ,int > > > vec;
int nowl1,nowr1,nxtl1,nxtr1,snowl1,snowr1;
nowl1= nowl*(nowl+4);
nowr1=nowr*(nowr+4);
nxtl1 = nxtl*nxtl;
nxtr1 = nxtr *nxtr;
snowl1= snowl *(snowl+1);
snowr1= snowr *(snowr+1);
vec.push_back({nowl,{nowl1,1}});
vec.push_back({nowr,{nowr1,1}});
vec.push_back({nxtl,{nxtl1,2}});
vec.push_back({nxtr,{nxtr1,2}});
vec.push_back({snowl,{snowl1,3}});
vec.push_back({snowr,{snowr1,3}});
sort(vec.begin(),vec.end(),cmp);
double ans=vec[3].first;
double anss;
int ops=vec[3].second.second;
cout<<nowl1<<' '<<nowr1<<' '<<nxtl1 << ' '<<nxtr1 <<' '<<snowl1<<' '<<snowr1<<endl;
if(ops == 1)
{
anss=sqrt(ans*ans/4+(ans/2+1)*(ans/2+1));
}else if(ops == 2)
{
anss= sqrt(2)*ans/2;
}else
{
anss = sqrt((ans/2)*(ans/2)+((ans+1)/2)*((ans+1)/2));
}
cout << fixed << setprecision(10) << anss << endl;
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3748kb
input:
11
output:
5 12 9 16 6 12 2.2360679775
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '5.0000000', error = '1.2360680'