結果

問題 No.1236 長針と短針
ユーザー tsuishitsuishi
提出日時 2020-12-29 12:31:35
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 1,390 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 30,208 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 13:15:10
合計ジャッジ時間 1,113 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#define DEBUGf

#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;
    if( h == 0 ) {
        if( m ) {
            kk = (60. - mm ) *60;
            kk += (1 * 60. / 11.)*60.;
        }
    } else if( h == 11 ) {
        kk = (60. - mm ) *60;
    } else {
        TRACE("h %.2f\n", h );
        vh = (h * 60. / 11.);
        TRACE("重なる位置(分)vh %.4f\n",vh);
        if( vh < vm ) {
            TRACE("h %.2f, vh %.2f, vm%.2f\n", h, vh, vm );
            TRACE("先に長針がある\n");
            h++;
            TRACE("h %.2f\n", h );
            kk = (60. - mm ) *60;
            kk += (h * 60. / 11.)*60. -1.0;
        } else if( vh > vm ) {
            TRACE("長針が後ろにある\n");
            TRACE("h %.2f, vh %.2f, vm%.2f\n", h, vh, vm );
            kk = (h * 60. / 11.)*60. - ( mm * 60. ) -1.0;
        }
    }
    printf("%.0f\n", kk  );
    return 0;
}
0