結果

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

ソースコード

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;
    minute += 60;
    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;
    }
    printf("%02d:%02d\n",hour,minute);
    return 0;
}
0