One through 1072

 

1072: HAART

Description [title]

Cocktail therapy, referred to as "highly active antiretroviral therapy." People on the basis of HAART also proposed a variety of improved therapies. To verify whether these treatments more effective than in the cocktail therapy, available by way of controlled clinical trials. HAART effective rate hypothesis x, new therapies effective rate y, yx if more than 5%, the better, if xy is greater than 5%, less effective, or almost called effect. Controlled clinical trials are given below n group, wherein the first group with HAART, n-1 other various modifications group therapy. Please write the program determines how effective various treatments to improve.

[Enter]

The first behavior integer n (1 <n≤20); the remaining two lines each n integers, the first integer is the total number of patients in clinical trials (10,000 or less), the efficacy of the second effective number of cases. This n rows, the first row HAART data, the remaining data to improve the behavior of various therapies.

[Output]

There are n-1 output lines, respectively, corresponding to the effect of improved therapy: better if, Better output; if the result is worse worse output; otherwise the output same.

This problem is nested loop in which the last judgment when using "if" and "else if" judgment;

The first program on the first direct marked

Program as follows:      

#include<iostream>
using namespace std;
int main()
{
int n,a[30][2];
double x,y;
int i;

cin>>n;//输入组数

for(i=0; i<n; i++) //输入数据
cin>>a[i][0]>>a[i][1];
x=1.0*a[0][1]/a[0][0];//计算第一种数据
for(i=1; i<n; i++) //进行比较
{
y=1.0*a[i][1]/a[i][0];//每组数据
if(y-x>0.05) cout<<"better"<<endl;
else if(x-y>0.05) cout<<"worse"<<endl;
else cout<<"same"<<endl;
}
return 0;
}

This problem is not too difficult, but the problem this question a little tiger who can come so long.

I started also was scared, so I spent a little time;

But in the end I also experienced a series of efforts made out

Cai Cai is still sin 

Guess you like

Origin www.cnblogs.com/--840-114/p/12214136.html