Time Conversion Onge Teacher C Programming Cap 3rd Chapter programming problem

Source: Internet
Author: User

Topic content:

When UTC is world-coordinated, the BJT is Beijing time, and UTC time equals the BJT minus 8. Now, your program reads an integer representing the time and minutes of the BJT. The number of bits and 10 digits of an integer represents the minute, and the hundred and thousands denote hours. If the hour is less than 10, there is no thousand part; If the hour is 0, there are no hundred parts, and if the hour is not 0 and the score is less than 10 points, 10 of the 0 bits are required, and 0 on 10 is not required if the hour is 10 and less than 0 points. If 1124 represents 11:24, while 905 means 9:5, 36 means 0:36, and 7 is 0:7.

The valid input range is 0 to 2359, which means that your program cannot read from the test server to input data from 0 to 2359.

Your program will output the UTC time corresponding to this time, the output format and input is the same, that is, the output of an integer, the time and minutes of UTC. The number of bits and 10 digits of an integer represents the minute, and the hundred and thousands denote hours. If the hour is less than 10, there is no thousand part; If the hour is 0, there are no hundred parts, and if the hour is not 0 and the score is less than 10 points, 10 of the 0 bits are required, and 0 on 10 is not required if the hour is 10 and less than 0 points.

Caution: Be careful with cross-day conversions.

Input format:

An integer that represents the time and minute of the BJT. The number of bits and 10 digits of an integer represents the minute, and the hundred and thousands denote hours. If the hour is less than 10, there is no thousand part; If the hour is 0, there are no hundred parts, and if the hour is not 0 and the score is less than 10 points, 10 of the 0 bits are required, and 0 on 10 is not required if the hour is 10 and less than 0 points.

Output format:

An integer that represents the time and minute of UTC. The number of bits and 10 digits of an integer represents the minute, and the hundred and thousands denote hours. If the hour is less than 10, there is no thousand part; If the hour is 0, there are no hundred parts, and if the hour is not 0 and the score is less than 10 points, 10 of the 0 bits are required, and 0 on 10 is not required if the hour is 10 and less than 0 points.

Input Sample:

803

Sample output:

3

time limit: 500ms memory limit: 32000kb
#include <stdio.h>intMain () {intBjt, UTC; inthour, minute; scanf ("%d", &BJT); Hour= BJT/ -; Minute= BJT% -; intIH = hour-8; if(ih<0) {IH= -+IH; } UTC= ih* -+minute; printf ("%d\n", UTC); return 0;}

Time Conversion Onge Teacher C Programming Cap 3rd Chapter programming problem

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.