题目:
题目内容:
title(s)xff1a;
UTC是世界协调时,BJT是北京时间,UTC时间相当于BJT减去8。现在,你的程序要读入一个整数,表示BJT的时和分。整数的个位和十位表示分,百位和千位表示小时。如果小时小于10,则没有千位部分;如果小时是0,则没有百位部分;如果小时不是0而分小于10分,需要保留十位上的0;如果小时是0而分小于10分的,则不需要保留十位上的0。如1124表示11点24分,而905表示9点5分,36表示0点36分,7表示0点7分。
UTC is xff0c; BJT is Beijing time xff0c; UTC time is equal to BJT minus 8. xff0c; now xff0c; your program is going to read an integer xff0c; means BJT time and minutes. Integer places and 10 points xff0c; 100 and thousands of hours. If hours are less than 10 xff0c; if hours are less than 10 xff0c; if thousands xff1b; if hours are 0xff0c; if hours are not 0 and xff1b; if hours are less than 10 points xff0c; if 10 hours xff0c; if hours are less than 10 points xff 0; if 10 points 0 0; if 10 points 0 points 0 0; if 1124 hours are not more than 11:24 xff0c; if 905 points 5 points xff 0c; if 36 points 0ff 0; if 0 points 0 points 7 points;
有效的输入范围是0到2359,即你的程序不可能从测试服务器读到0到2359以外的输入数据。
The effective input range is 0 to 2359, that is, your program cannot read from the test server to input data from 0 to 2359.
你的程序要输出这个时间对应的UTC时间,输出的格式和输入的相同,即输出一个整数,表示UTC的时和分。整数的个位和十位表示分,百位和千位表示小时。如果小时小于10,则没有千位部分;如果小时是0,则没有百位部分;如果小时不是0而分小于10分,需要保留十位上的0;如果小时是0而分小于10分的,则不需要保留十位上的0。
Your program is to export UTC time & #xff0c; the same format and input xff0c for this time; xff0c; i.e., xff0c for an integer xff0c; xff0c; hundreds and thousands of hours. If hours are less than 10xff0c; if hours are less than 0xff0c; if hours are 0xff0c; if hours are less than 0xff1b; if hours are less than 10xff0c; if hours are less than 10xff1b; if hours are less than 10xff0c; if there is no need for ten.
提醒:要小心跨日的换算。
Reminders & #xff1a; be careful to convert across days.
输入格式:
Entering format:
一个整数,表示BJT的时和分。整数的个位和十位表示分,百位和千位表示小时。如果小时小于10,则没有千位部分;如果小时是0,则没有百位部分;如果小时不是0而分小于10分,需要保留十位上的0;如果小时是0而分小于10分的,则不需要保留十位上的0。
An integer xff0c; means BJT hours and minutes. Integer bits and ten points xff0c; hundred and thousands of hours. If hours are less than 10xff0c; if thousands xff1b; if hours are 0xff0c; if 100 xff1b; if hours are not 0 xff0c; if hours are less than 10 xff0c; if ten xff1b; if hours are less than 10 xff0c; no need to keep 0 10.
输出格式:
output formatxff1a;
一个整数,表示UTC的时和分。整数的个位和十位表示分,百位和千位表示小时。如果小时小于10,则没有千位部分;如果小时是0,则没有百位部分;如果小时不是0而分小于10分,需要保留十位上的0;如果小时是0而分小于10分的,则不需要保留十位上的0。
An integer & #xff0c; means the time and minutes of the UTC. Integer bits and ten points & #xff0c; hundred and thousands of hours. If hours are less than 10xff0c, there are no thousands xff1b; if hours are 0xff0c; there are no hundred xff1b; if hours are not 0 xff0c; if hours are less than 10 xff1b; if hours are 0 xff0c; there is no need to keep 10 0.
输入样例:803? ? ? ? ?输出样例:3
Enter sample xff1a; 803? strong> Output sample xff1a; 3
Tip:主要是跨日换算不好下手,当T1小于480min时,不妨想象先将T1从480中减掉,再将该差值从24*60min中减掉,便是T的值
Tip: mainly trans-days xff0c; when T1 is less than 480min xff0c; imagine reducing T1 from 480 xff0c first; then reducing the difference from 24*60min xff0c; or T
代码:
code #xff1a;
?代码:
? code #xff1a;
#include<stdio.h>
int main()
{
? ? int UTC,BTC,a,b,c,d,T,T1;
? ? scanf("%d",&BTC);
? ? a=BTC/1000;
? ? b=BTC/100-BTC/1000*10;
? ? c=BTC%100/10;
? ? d=BTC%100-c*10;
? ? T1=(a*10+b)*60+c*10+d;
? ? T=T1-480;
? ? if(T>=0){
? ? ? ? UTC=T/60*100+T-T/60*60;
? ? ? ? printf("%d",UTC);
? ? ? ?}
? ? if(T<0){
? ? ? ? T=24*60-(480-T1);
? ? ? ? UTC=T/60*100+T-T/60*60;
? ? ? ? printf("%d",UTC);
? ? ? ? }
? ? return 0;
}
?
?
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论