1.5 18: Cocktail therapy

Description
Cocktail therapy, originally referred to as "Highly Active Antiretroviral Therapy" (HAART), was proposed by Chinese American scientist Dayi He in 1996 to treat AIDS through the combined use of three or more antiviral drugs. The application of this therapy can reduce the drug resistance caused by a single drug, inhibit the replication of the virus to the greatest extent, and restore part or all of the damaged immune function of the body, thereby delaying the progression of the disease, prolonging the life of the patient, and improving the quality of life. People have proposed many improved therapies on the basis of cocktail therapy. In order to verify whether these treatments are better than cocktail therapy in terms of efficacy, they can be carried out through clinical controlled experiments. Assuming that the effective rate of cocktail therapy is x and the effective rate of the new therapy is y, if yx is greater than 5%, the effect is better, if xy is greater than 5%, the effect is worse, otherwise it is said that the effect is similar. The following are n groups of clinical controlled experiments. The first group adopts cocktail therapy, and the other n-1 groups are various improved therapies. Please write a program to determine how effective the various improvement treatments are.

Enter the
integer n in the first line (1 <n <= 20); the
remaining n lines have two integers in each line. The first integer is the total number of clinical trials (less than or equal to 10000), and the second is the number of effective cases.
Among the n rows of data, the first behavior is the data of cocktail therapy, and the rest are data of various improvement therapies.
Output
has the output line n-1, respectively, corresponding to the effect of improved therapy:
if better, Better output; if the result is worse worse output; otherwise the same output
sample input
. 5
125 99
112 89
145 99
99 97
123 98
comp Example output
same
worse
better
same

#include <iostream>
using namespace std;
int main()
{
    
    
	int n,sum,effect;
	double x,y;
	cin>>n;
	cin>>sum>>effect;
	x = 1.0*effect/sum;
	for(int i=1;i<n;i++)
	{
    
    
		cin>>sum>>effect;
		y = 1.0*effect/sum;
		if(y-x>0.05)
		{
    
    
			cout<<"better"<<endl;
		}else if(x-y>0.05)
		{
    
    
			cout<<"worse"<<endl;
		}else{
    
    
			cout<<"same"<<endl;
		}
	}
	return 0;
}

Guess you like

Origin blog.csdn.net/yansuifeng1126/article/details/112019176