18: Cocktail therapy, 18 cocktail therapy
18: Cocktail therapy
- View
- Submit
- Statistics
- Question
-
Total time limit:
-
1000 ms
-
Memory limit:
-
65536kB
-
Description
-
Cocktail therapy, originally referred to as "efficient anti-viral therapy" (HAART), was proposed by a Chinese-American scientist, he freshman in 1996, it is used in combination with three or more antiviral drugs to treat AIDS. The application of this therapy can reduce the drug resistance produced by a single drug, inhibit virus replication to the maximum extent, and recover partially or even all of the damaged immunity function, thus delaying the progress of the disease, prolong the lives of patients and improve the quality of life. On the basis of cocktail therapy, many improved therapies have been proposed. To verify whether these treatments are more effective than cocktail therapy, they can be performed through a clinical controlled trial. Assume that cocktail therapy is efficient x and new therapy is efficient y. if y-x is greater than 5%, the effect is better. If x-y is greater than 5%, the effect is worse, otherwise, the effect is similar. N groups of clinical control experiments were given below, with the first group using cocktail therapy and n-1 groups using a variety of improved treatments. Please write a program to determine the effects of various improved treatments.
-
Input
-
The first behavior is an integer n (1 <n <= 20 );
The remaining n rows have two integers per row. The first integer is the total number of clinical cases (less than or equal to 10000), and the second effective number of cases.
Among the n rows of data, the data on the first behavior of cocktail therapy, and data on various other behavior improvement treatments.
-
Output
-
There are n-1 rows of output, indicating the effect of corresponding improved Therapy:
If the effect is better, the output is better. If the effect is worse, the output is worse; otherwise, the output is same.
-
Sample Input
-
5125 99112 89145 9999 97123 98
-
Sample output
-
sameworsebettersame
1 #include<iostream> 2 using namespace std; 3 int ans[10001]; 4 int main() 5 { 6 int n; 7 float a,b; 8 cin>>n; 9 float x,y;10 for(int i=1;i<=n;i++)11 {12 cin>>a>>b;13 if(i==1)14 {15 x=(b/a)*100;16 continue;17 }18 else y=(b/a)*100;19 if((y-x)>5)ans[i]=1;20 else if((x-y)>5)ans[i]=-1;21 else ans[i]=0;22 }23 for(int i=2;i<=n;i++)24 {25 if(ans[i]==1)26 cout<<"better"<<endl;27 else if(ans[i]==-1)28 cout<<"worse"<<endl;29 else if(ans[i]==0)30 cout<<"same"<<endl;31 }32 return 0;33 }