結果

問題 No.1236 長針と短針
ユーザー tsuishitsuishi
提出日時 2020-12-28 17:13:15
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 1,373 bytes
コンパイル時間 1,429 ms
コンパイル使用メモリ 29,696 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-14 10:43:42
合計ジャッジ時間 2,439 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,948 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 WA -
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1 ms
6,944 KB
testcase_12 WA -
testcase_13 AC 1 ms
6,940 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
6,944 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#define DEBUGr

#define NOP do{}while(0)
#ifdef DEBUG
#define TRACE(...) do{printf(__VA_ARGS__);fflush(stdout);}while(0)
#define TRACECR do{printf("\n");fflush(stdout);}while(0)
#else
#define TRACE(...) NOP
#define TRACECR NOP
#endif
int main( void ) {
    int hh,mm;
    double h,m;
    double vh,vm,vl;
    double kk = 0.;
    double min = 60.0 * 60.0;

    scanf("%d %d", &hh, &mm );
    h = (double)hh;
    m = (double)mm;
    TRACE("%02d:%02d\n",hh,mm);
    vm = m;
    TRACE("長針の進み具合 vm %.4f\n",vm);
    if( h >= 12.0 ) h -= 12.0;
    vh = (h * 5 ) + ( (h/12) * 5. );
    TRACE("短針の向きvh %.4f\n",vh);
    if( vh < vm ) {
        TRACE("先に長針がある\n");
        kk = (60 - mm)*60;
        TRACE("0までの秒数 kk %.4f\n",kk);
        h++;    if( h >= 12.0 ) h -= 12.0;
        TRACE("目標時刻 h%.4f\n",h);
        vl = (h * 60. ) /11.;
        TRACE("重なる向き(分) vl %.4f\n",vl);
        kk +=  (vl) * 60. ;
    } else if( vh > vm ) {
        TRACE("長針が後ろにある\n");
        kk = (60 - mm)*60;
        TRACE("0までの秒数 kk %.4f\n",kk);
        if( h >= 12.0 ) h -= 12.0;
        TRACE("目標時刻 h%.4f\n",h);
        vl = (h * 60. ) /11.;
        TRACE("重なる向き(分) vl %.4f\n",vl);
        kk = (vl * 60.0) - (mm * 60.);
    }
    printf("%.0f\n", kk  );
    return 0;
}
0