您的位置:首页 > 编程语言 > C语言/C++

bnu1326 乒乓游戏 C语言版

2008-12-30 12:11 295 查看
北京师范大学珠海分校
Judge Online of ACM ICPC
1326 乒乓游戏
C语言版
#include <stdio.h>

int calc(int x,int y){
    if((x-30)*(x-30)+(y-30)*(y-30)<400) return 1;
    else if ((x-100)*(x-100)+(y-30)*(y-30)<100) return 2;
    else if ((x-170)*(x-170)+(y-30)*(y-30)<25) return 3;
    else return 0;
}

int main(){
    int t,n,x,y,score;
    scanf("%d",&t);
    while(t--){
        score=0;
        scanf("%d",&n);
        while(n--){
            scanf("%d%d",&x,&y);
            score+=calc(x,y);
        }
        printf("%d/n",score);
    }
    return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  语言 游戏 c