# 标签归档：水题  # HDOJ1014：Uniform Generator # HDOJ1038:Biker’s Trip Odometer——数学题

Problem Description
Most bicycle speedometers work by using a Hall Effect sensor fastened to the front fork of the bicycle. A magnet is attached to one of the spokes on the front wheel so that it will line up with the Hall Effect switch once per revolution of the wheel. The speedometer monitors the sensor to count wheel revolutions. If the diameter of the wheel is known, the distance traveled can be easily be calculated if you know how many revolutions the wheel has made. In addition, if the time it takes to complete the revolutions is known, the average speed can also be calculated.
For this problem, you will write a program to determine the total distance traveled (in miles) and the average speed (in Miles Per Hour) given the wheel diameter, the number of revolutions and the total time of the trip. You can assume that the front wheel never leaves the ground, and there is no slipping or skidding.

Input
Input consists of multiple datasets, one per line, of the form:

diameter revolutions time

The diameter is expressed in inches as a floating point value. The revolutions is an integer value. The time is expressed in seconds as a floating point value. Input ends when the value of revolutions is 0 (zero).

Output
For each data set, print:

Trip #N: distance MPH

Of course N should be replaced by the data set number, distance by the total distance in miles (accurate to 2 decimal places) and MPH by the speed in miles per hour (accurate to 2 decimal places). Your program should not generate any output for the ending case when revolutions is 0.

Constants

For p use the value: 3.1415927.
There are 5280 feet in a mile.
There are 12 inches in a foot.
There are 60 minutes in an hour.
There are 60 seconds in a minute.
There are 201.168 meters in a furlong.

Sample Input
26 1000 5
27.25 873234 3000
26 0 1000

Sample Output
Trip #1: 1.29 928.20
Trip #2: 1179.86 1415.84

```#include
#define Pi 3.1415927

int main()
{
int n,c=0;
double t,d,v,s;
while(scanf("%lf%d%lf",&d,&n,&t)!=EOF && n!=0)
{
s=n*Pi*d/12/5280;
v=s/(t/60/60);
printf("Trip #%d: %.2lf %.2lf\n",++c,s,v);
}
return 0;
}

``` # HDOJ1037:Keep on Truckin' # HDOJ1064:Financial Management # HDOJ2070:Fibbonacci Number——一道水题  # HDOJ1108：最小公倍数

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 33998 Accepted Submission(s): 19029

Problem Description

Input

Output

Sample Input
10 14

Sample Output
70

```#include
int main()
{
int a,b,ai,bi,temp;
while (scanf ("%d %d",&a,&b) != EOF)
{
ai = a;
bi = b;
while (bi != 0)
{
temp = bi;
bi = ai % bi;
ai = temp;
}
printf ("%dn",a*b/ai);
}
return 0;
}
``` # HDOJ2071:Max Num

Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 13674 Accepted Submission(s): 8661
Problem Description
There are some students in a class, Can you help teacher find the highest student .

Input
There are some cases. The first line contains an integer t, indicate the cases; Each case have an integer n ( 1 ≤ n ≤ 100 ) , followed n students’ height.

Output
For each case output the highest height, the height to two decimal plases;

Sample Input
2
3 170.00 165.00 180.00
4 165.00 182.00 172.00 160.00

Sample Output
180.00
182.00

```#include
int main()
{
int n,ni,j,ji;
double num,ans;
scanf("%d",&n);
for(ni=0;nians)
{
ans=num[ji];
}
}
printf("%.2lfn",ans);
}
return 0;
}

``` # HDOJ2107：Founding of HDU

Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 6500 Accepted Submission(s): 4403
Problem Description

Input

Output

Sample Input
3
1 2 3
0

Sample Output
3

```#include
int main()
{
int n,ni,a,out;
while(scanf("%d",&n)&&(n!=0))
{
for(ni=0;ni<n;ni++) 		{ 			scanf("%d",&a[ni]); 			if(ni==0) 			{ 				out=a[ni]; 			} 			if(a[ni]>out)
{
out=a[ni];
}
}
printf("%dn",out);
}
return 0;
}

``` # HDOJ1976：Software Version

Problem Description

Input

Output

Sample Input
3
1 1 0
1 1 1
1 1 1
1 1 0
1 1 1
1 1 1

Sample Output
Second
First
Same

```#include
#include
int main()
{
int n, ni, a, b;
scanf("%d", &n);
for (ni = 0; ni<n; ni++) 	{ 		memset(a, 0, sizeof(a)); 		memset(b, 0, sizeof(b)); 		scanf("%d%d%d", &a, &a, &a); 		scanf("%d%d%d", &b, &b, &b); 		if (a>b) printf("Firstn");
else
{
if (a < b) printf("Secondn"); 			else 			{ 				if (a>b) printf("Firstn");
else
{
if (a < b) printf("Secondn"); 					else 					{ 						if (a>b) printf("Firstn");
else
{
if (a < b) printf("Secondn");
else printf("Samen");
}
}
}
}
}
}
return 0;
}
``` # HDOJ2304：Electrical Outlets

Problem Description
Roy has just moved into a new apartment. Well, actually the apartment itself is not very new, even dating back to the days before people had electricity in their houses. Because of this, Roy’s apartment has only one single wall outlet, so Roy can only power one of his electrical appliances at a time.
Roy likes to watch TV as he works on his computer, and to listen to his HiFi system (on high volume) while he vacuums, so using just the single outlet is not an option. Actually, he wants to have all his appliances connected to a powered outlet, all the time. The answer, of course, is power strips, and Roy has some old ones that he used in his old apartment. However, that apartment had many more wall outlets, so he is not sure whether his power strips will provide him with enough outlets now.
Your task is to help Roy compute how many appliances he can provide with electricity, given a set of power strips. Note that without any power strips, Roy can power one single appliance through the wall outlet. Also, remember that a power strip has to be powered itself to be of any use.

Input
Input will start with a single integer 1 <= N <= 20, indicating the number of test cases to follow. Then follow N lines, each describing a test case. Each test case starts with an integer 1 <= K <= 10, indicating the number of power strips in the test case. Then follow, on the same line, K integers separated by single spaces, O1 O2 . . . OK, where 2 <= Oi <= 10, indicating the number of outlets in each power strip.

Output
Output one line per test case, with the maximum number of appliances that can be powered.

Sample Input
3
3 2 3 4
10 4 4 4 4 4 4 4 4 4 4
4 10 10 10 10

Sample Output
7
31
37

```#include
int main()
{
int n,ni,j,ji,a,sum;
scanf("%d",&n);
while(n--)
{
scanf("%d",&j);
sum=0;
for(ji=0;ji

```