D: Dragon Balls

瞎搞题

刚开始没有反应过来
想着有没有什么正解。
但是WA了一发之后,思考了很久
突然意识到
妈妈组这个条件的一定不会很多!!!
然后抱着试试的心态,交了一发

#include<iostream>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
typedef long long ll;
const int max_n = 1e6+100;
const int bo = 1000000;
ll query(int x,int y)
{
    cout<<x<<" "<<y<<endl;
    cout.flush();
    ll d;cin>>d;
    return d;
}
map<ll,bool> mp;
int main()
{
    ios::sync_with_stdio(0);
    for (ll i=0;i<=bo;++i)mp[i*i]=1;
    int n;cin>>n;
    while (n--)
    {
        ll d = query(0,0);
        for (ll x=0;x*x<=d;++x)
        {
            if (mp.count(d-x*x))
            {
                if (query(x,sqrt(d-x*x))==0)
                {
                    break;
                }
            }
        }
    }
}
全部评论

相关推荐

不愿透露姓名的神秘牛友
07-16 18:05
何尝不是一种学历歧视呢
码农索隆:楼主明确拒绝,并说明拒绝原因了,这hr倒是挺忠心护主的
点赞 评论 收藏
分享
陆续:不可思议 竟然没那就话 那就我来吧 :你是我在牛客见到的最美的女孩
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务