結果

問題 No.1010 折って重ねて
ユーザー bluemeganebluemegane
提出日時 2020-03-21 09:06:57
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,102 bytes
コンパイル時間 3,985 ms
コンパイル使用メモリ 104,896 KB
実行使用メモリ 22,804 KB
最終ジャッジ日時 2023-08-22 20:22:50
合計ジャッジ時間 11,435 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
22,804 KB
testcase_01 AC 57 ms
20,568 KB
testcase_02 AC 57 ms
20,708 KB
testcase_03 AC 57 ms
20,680 KB
testcase_04 AC 58 ms
20,680 KB
testcase_05 AC 58 ms
20,568 KB
testcase_06 AC 57 ms
20,756 KB
testcase_07 AC 58 ms
20,732 KB
testcase_08 AC 58 ms
20,580 KB
testcase_09 AC 57 ms
20,668 KB
testcase_10 AC 56 ms
20,552 KB
testcase_11 AC 57 ms
22,676 KB
testcase_12 AC 57 ms
20,684 KB
testcase_13 AC 57 ms
20,808 KB
testcase_14 AC 58 ms
22,796 KB
testcase_15 AC 56 ms
20,804 KB
testcase_16 AC 58 ms
20,676 KB
testcase_17 AC 57 ms
20,820 KB
testcase_18 AC 58 ms
22,736 KB
testcase_19 AC 57 ms
20,840 KB
testcase_20 AC 58 ms
20,684 KB
testcase_21 AC 57 ms
22,752 KB
testcase_22 AC 57 ms
20,560 KB
testcase_23 AC 58 ms
20,652 KB
testcase_24 AC 58 ms
20,628 KB
testcase_25 AC 57 ms
20,728 KB
testcase_26 AC 58 ms
20,584 KB
testcase_27 AC 58 ms
22,544 KB
testcase_28 AC 58 ms
20,572 KB
testcase_29 AC 58 ms
20,664 KB
testcase_30 AC 60 ms
20,708 KB
testcase_31 AC 58 ms
18,516 KB
testcase_32 AC 58 ms
20,708 KB
testcase_33 AC 57 ms
20,708 KB
testcase_34 AC 57 ms
22,732 KB
testcase_35 AC 58 ms
22,612 KB
testcase_36 AC 58 ms
20,724 KB
testcase_37 AC 58 ms
20,860 KB
testcase_38 AC 58 ms
20,680 KB
testcase_39 AC 58 ms
20,784 KB
testcase_40 AC 58 ms
22,728 KB
testcase_41 AC 58 ms
20,568 KB
testcase_42 AC 57 ms
20,768 KB
testcase_43 TLE -
testcase_44 -- -
testcase_45 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = long.Parse(line[0]) * 1000L;
        var b = long.Parse(line[1]) * 1000L;
        var h = long.Parse(line[2]);
        var g1 = gcd(a, b);
        var g2 = gcd(h, g1);
        a /= g2;
        b /= g2;
        h /= g2;
        var count = 0;
        while (a > h | b > h)
        {
            if ((a < b && a > h) | (b <= a && b < h))
            {
                if (a % 2 == 0) { a /= 2; h *= 2; }
                else { b *= 2; h *= 4; }
                count++;
            }
            else if ((b <= a && b > h) | (a <= b && a < h))
            {
                if (b % 2 == 0) { b /= 2; h *= 2; }
                else { a *= 2; h *= 4; }
                count++;
            }
        }
        Console.WriteLine(count);
    }
    public static long gcd(long a, long b)
    {
        if (a < b) return gcd(b, a);
        while (b != 0)
        {
            var w = a % b;
            a = b;
            b = w;
        }
        return a;
    }
}

0