結果

問題 No.652 E869120 and TimeZone
ユーザー Shirapon_pon
提出日時 2021-05-17 02:42:01
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 716 bytes
コンパイル時間 1,125 ms
コンパイル使用メモリ 29,184 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-05 16:59:39
合計ジャッジ時間 1,077 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 29 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(int argc, char *argv[]){
    int hour,minute;
    char timezone[10];
    char tmp[10]={0};
    int h_timezone,m_timezone = 0;
    scanf("%d%d%s",&hour,&minute,timezone);
    hour += 15;
    strncpy(tmp,timezone+3,5);
    h_timezone = atof(tmp);
    m_timezone = atof(tmp)*60-h_timezone*60;
    hour +=h_timezone;
    minute += m_timezone;
    while (minute >= 60)
    {
        minute -= 60;
        hour++;
    }
    while (hour >= 24)
    {
        hour -=24;
    }
    while (minute < 0)
    {
        minute += 60;
        hour--;
    }
    while (hour < 0)
    {
        hour +=24;
    }
    printf("%02d:%02d\n",hour,minute);
    return 0;
}
0