1012: Foreign currency Exchange score: 1Time limit: 1 seconds Memory limit: 32 Mega Special Problem: No submission: 18 Solution: 13
Topic Description
Xiao Ming just came back from the United States, found that there are still some unused U.S. dollars, so want to go to the bank to change into renminbi. But heard that the renminbi will appreciate recently, and from the financial institutions to get the next 12 months of the possible dollar against the renminbi, now, Xiaoming wants in the next year to convert the U.S. dollars into renminbi, ask how much can get the yuan. Input Format
The first line you enter is a real number N (1.00<=n<=100.00), which indicates the amount of US dollars that Bob has available.
The next line, which contains 12 real AI (5.00<=ai<=7.00), represents the dollar's exchange rate for the next 12 months.
Output
Output a decimal R, which indicates the maximum number of yuan that xiaoming can get, and the result retains two decimal places. Sample Input
46.91
6.31 6.32 6.61 6.65 5.55 5.63 6.82 6.42 6.40 5.62 6.78 Example Output
319.93 tip [+]
Hint is hidden, click above [+] to show * * *
The greedy topic of super water
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int main ()
{
double a[12];
int i,j;
double S;
scanf ("%lf", &s);
for (i=0;i<12;i++)
scanf ("%lf", &a[i));
Sort (a,a+12);
printf ("%.2f\n", a[11]*s);
return 0;
}