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;
}
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;
}
相关文章推荐
- bnu1276 阿笠博士的游戏 C语言版
- bnu1269 报数游戏 C语言版
- bnu1209 1-->0的神奇游戏 C语言版
- 简单的三子棋游戏(C语言版)
- Html5游戏开发之乒乓Ping Pong游戏示例(二)
- bnu1262 水管工人的烦恼 C语言版
- bnu1273 素素的困惑 C语言版
- bnu1288 先发阵容 C语言版
- bnu1067 工作出色的辉蛋 C语言版
- bnu1079 BNUEP的球迷 C语言版
- bnu1210 搬桌子难题 C语言版
- bnu 10783 格斗游戏 线段与圆的关系
- bnu1263 疯狂英语 C语言版
- bnu1274 爱写注释的学生 C语言版
- bnu1295 BNUEP的风云人物 C语言版
- bnu1059 星际争霸之单挑 C语言版
- bnu1068 爱玩的辉蛋 C语言版
- bnu1214 诗人的诞生 C语言版
- bnu1248 蜗牛宝宝 C语言版