栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

zoj 2220 Watchdog

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

zoj 2220 Watchdog

#include<iostream>#include<cmath>#include<string.h>#include<stdio.h> using namespace std;enum {    SIZ = 44,    Num = 52,};struct Point {    int x,y;};Point tree[Num];int pos;int size;void readIn(){    cin>>size>>pos;    for(int i=0;i<pos;i++){        cin>>tree[i].x>>tree[i].y;    }}int test(int x, int y){    int i;    double t, val = -1;    for(i=0;i<pos;i++){        if(tree[i].x == x && tree[i].y == y) return 0;        t = (x-tree[i].x)*(x-tree[i].x)+(y-tree[i].y)*(y-tree[i].y);        t = sqrt(t);        if(t >= val){ val = t;        }    }    t = val;    if(x<t || y<t || size-x<t || size-y<t)        return 0;    return 1;}void fun(){    int i,j;    for(i=1;i<size;i++){        for(j=1;j<size;j++){ if(test(i,j)){     cout<<i<<" "<<j<<endl;     return; }        }    }    cout<<"poodle"<<endl;}int main(){    int tstcase;    cin>>tstcase;    while(tstcase --){        readIn();        fun();    }return 0;}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/378163.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号