Two Tigers Description
Come, let's relax, listen to the nursery rhymes, and "sing" together.
Two tigers, two tigers, run fast.
One has no ears and one has no tail.
It's strange, it's strange.
TMK also felt very strange, because in front of him suddenly appeared a group of such tigers, some have no ears, some have no tail, but there are normal.
Now TMK tells you the number of ears, the number of tails, and the number of legs of the tiger, and how much it is normal to ask you.
There are only three species of tigers:
The first (normal): 2 ears, 1 tails, 4 legs
Second (no ears): 0 ears, 1 tails, 4 legs
Third (no tail): 2 ears, 0 tails, 4 leg Input
The first line of an integer t indicates how many groups of samples there are.
Next each row is a sample:
Contains three integers a,b,c indicates a total of a ear, B tail, C (<=4000) leg, the data guaranteed to have the solution. Output
For each set of sample output lines, the number of normal tigers is indicated. Sample Input 112 7 Sample Output 3 HINT
The idea of solving problems: violence
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <climits>
using namespace std;
#define LL Long
const int inf=0x3f3f3f3f;
int main ()
{
int t,a,b,c;
scanf ("%d", &t);
while (t--)
{
scanf ("%d%d%d", &a,&b,&c);
c/=4;
for (int i=0; i<=1000; i++)
{for
(int j=0; j<=1000; j + +)
{
if i*2+ (c-i-j) *2==a&&i+j ==b)
{
printf ("%d\n", I);
Break
;
}}} return 0;
}