View Code of Problem 448

#include<iostream>
#include<string>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<ctype.h>
using namespace std;
int main()
{
	long long int n;
	while (cin >> n)
	{
		while (n--)
		{
			int a, b;
			cin >> a >> b;
			double num1;
			if (a <= 3)
			{
				double z = b * (2.5 / 4 - 2 / 5.0);
				int num = (int)(z + 0.5);
				cout << num << endl;
				continue;
			}
			else if (a > 3 && a <= 10)
			{
				double z=(a-3)*0.5+ b * (2.5 / 4 - 2 / 5.0);
				int num = (int)(z + 0.5);
				cout << num << endl;
				continue;
			}
			else
			{
				double z = 7*0.5 + b * (2.5 / 4 - 2 / 5.0)+(a-10)*0.75;
				int num = (int)(z + 0.5);
				cout << num << endl;
				continue;
			}
		}
	}
}

Double click to view unformatted code.


Back to problem 448