wolf and rabbit
来源:互联网 发布:质量数据的统计方法 编辑:程序博客网 时间:2024/05/19 21:14
There is a hill with n holes around. The holes are signed from 0 to n-1.
A rabbit must hide in one of the holes. A wolf searches the rabbit in anticlockwise order. The first hole he get into is the one signed with 0. Then he will get into the hole every m holes. For example, m=2 and n=6, the wolf will get into the holes which are signed 0,2,4,0. If the rabbit hides in the hole which signed 1,3 or 5, she will survive. So we call these holes the safe holes.
A rabbit must hide in one of the holes. A wolf searches the rabbit in anticlockwise order. The first hole he get into is the one signed with 0. Then he will get into the hole every m holes. For example, m=2 and n=6, the wolf will get into the holes which are signed 0,2,4,0. If the rabbit hides in the hole which signed 1,3 or 5, she will survive. So we call these holes the safe holes.
21 22 2
NOYES
程序如下:
#include<cstdio>int gcd(int a,int b) {return !b?a:gcd(b,a%b);}int main() {int T;scanf("%d",&T);while(T--) {int m,n;scanf("%d %d",&m,&n);printf("%s\n",gcd(m,n)==1?"NO":"YES");}return 0;}
阅读全文
1 0
- HDU1222:Wolf and Rabbit
- 1222 Wolf and Rabbit
- Wolf and Rabbit tzc
- hdu1222-Wolf and Rabbit
- Wolf and Rabbit
- Wolf and Rabbit
- HDU1222 Wolf and Rabbit
- Wolf and Rabbit
- HDOJ1222--Wolf and Rabbit
- Wolf and Rabbit<hdoj1222>
- A - Wolf and Rabbit
- Wolf and Rabbit
- Wolf and Rabbit
- Wolf and Rabbit
- Wolf and Rabbit hdu1222
- Wolf and Rabbit
- Wolf and Rabbit
- wolf and rabbit
- selenuim
- 另一种阶乘问题
- 判断素数
- 文件的归档压缩
- js中更改div的背景颜色:
- wolf and rabbit
- 在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数
- 云服务器 ECS Linux 下使用 NTFS 文件系统示例
- SQL 心得
- 团队成员技术发展路线
- 文章标题
- MOOC清华《程序设计基础》第6章:最长公共子序列问题(动态规划)
- 简单贪心 hdoj2037(今年暑假不AC)
- 一年工作记