南阳oj鸡兔同笼
2015-01-11 15:38
232 查看
#include<stdio.h> int main() { int head,foot; int x,y,N; scanf("%d",&N); while(N--){ scanf("%d%d",&head,&foot); x=(4*head-foot)/2; y=(foot-2*head)/2; if(x<0||y<0){ x=0;y=0;} if((2*x==4*head-foot)||(2*y==foot-2*head)) printf("%d %d\n",x,y); else printf("No answer\n"); } return 0; }这是一个简单的程序,话也不多说了
相关文章推荐
- 南阳OJ 题目64:鸡兔同笼
- 南阳oj 题目64 鸡兔同笼
- 孙子算经与鸡兔同笼
- 鸡兔同笼
- 百练 2750 鸡兔同笼
- NYOJ 64 鸡兔同笼 2013年8月20日
- NYOJ64 鸡兔同笼
- 35.鸡兔同笼问题:今有雉兔同笼,上有三十五头,下有九十四足,问雉兔各几何?
- Sicily 3498 分解质因数 & 3496 鸡兔同笼
- Openjudge-计算概论(A)-鸡兔同笼
- NYOJ 64 鸡兔同笼
- NYOJ_64 鸡兔同笼
- 鸡兔同笼
- 南阳题目64-鸡兔同笼
- C++程序(百元买百鸡、分出奇偶数、鸡兔同笼问题、选择排序法、整数奇偶排序)
- NYOJ_64鸡兔同笼
- OJ_320.鸡兔同笼
- 鸡兔同笼问题
- c++鸡兔同笼
- 题目1155:鸡兔同笼