1109:0 starting point learning algorithm 16--chicken rabbit cage time limit:1 Sec Memory limit:64 MB 64bit IO Format:%lld
submitted:4456 accepted:1355
[Submit] [Status] [Web Board] Description
Chickens and rabbits in the same cage, the total number of known N and the total number of legs m, the number of chickens and the number of rabbits.
Input
Input 2 integers are N and m (multiple sets of test data)
Output
The number of chickens exported and the number of rabbits, separated by a space between, if no solution output no (each group of test data row)
Sample Input
14 32
Sample Output
12 2
Source
0 Starting point Learning algorithm
1#include <stdio.h>2 intMain () {3 intn,m;4 while(SCANF ("%d%d", &n,&m)! =EOF) {5 if((m>=2*n) && (m<=4*n) && (m%2==0))6printf"%d%d\n",2*n-m/2, m/2-n);7 Else8printf"no\n");9 }Ten return 0; One}
Direct when!!!
1109:0 starting point algorithm 16--chicken rabbit with Cage