Zoj 3600 12Provincial competition questionsTaxi fare
This section describes in detail the taxi charging standards in Hangzhou in the past and now, provides the mileage and waiting time, and calculates the difference between the two charging standards.
Thought: Nothing to say ......
Code:
# Include <stdio. h> struct fare {double xfare; double wfare; int fare;} Ori, now; int main () {int I, N, S; Double X, time; while (scanf ("% d", & N )! = EOF) {for (I = 1; I <= N; I ++) {scanf ("% lf", & X, & time ); if (x> = 10) Ori. xfare = 2.00*7 + 3.00 * (X-10); If (x <= 3) Ori. xfare = 0; If (x> 3 & x <10) Ori. xfare = 2.00 * (X-3); Ori. wfare = 0.4000 * time; Ori. fare = (Ori. wfare + Ori. xfare + 0.5) * 100/100; If (x> = 10) now. xfare = 2.50*7 + 3.75 * (X-10); If (x <= 3) now. xfare = 0; If (x> 3 & x <10) now. xfare = 2.50 * (X-3); now. wfare = 0.625 * time; now. fare = (now. wfare + now. xfare + 0.5) * 100/100; S = now. fare-Ori. fare; printf ("% d \ n", S) ;}} return 0 ;}