Zoj 3600 12-year provincial competition question taxi fare

Source: Internet
Author: User

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 ;}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.