結果

問題 No.1010 折って重ねて
ユーザー bluemeganebluemegane
提出日時 2020-03-21 08:52:57
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,040 bytes
コンパイル時間 2,056 ms
コンパイル使用メモリ 102,796 KB
実行使用メモリ 22,808 KB
最終ジャッジ日時 2023-08-22 20:00:36
合計ジャッジ時間 7,208 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,756 KB
testcase_01 AC 57 ms
20,732 KB
testcase_02 AC 58 ms
20,768 KB
testcase_03 AC 56 ms
20,636 KB
testcase_04 AC 56 ms
20,780 KB
testcase_05 AC 57 ms
20,736 KB
testcase_06 AC 57 ms
20,788 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 57 ms
20,764 KB
testcase_11 AC 57 ms
20,788 KB
testcase_12 WA -
testcase_13 AC 57 ms
22,784 KB
testcase_14 AC 56 ms
22,808 KB
testcase_15 AC 57 ms
20,780 KB
testcase_16 AC 56 ms
18,800 KB
testcase_17 AC 58 ms
20,748 KB
testcase_18 AC 58 ms
18,684 KB
testcase_19 WA -
testcase_20 AC 57 ms
20,716 KB
testcase_21 AC 57 ms
20,700 KB
testcase_22 WA -
testcase_23 AC 56 ms
20,736 KB
testcase_24 AC 57 ms
20,712 KB
testcase_25 AC 57 ms
20,652 KB
testcase_26 WA -
testcase_27 AC 57 ms
20,632 KB
testcase_28 AC 57 ms
22,744 KB
testcase_29 AC 57 ms
22,800 KB
testcase_30 AC 57 ms
20,812 KB
testcase_31 AC 56 ms
20,812 KB
testcase_32 WA -
testcase_33 AC 58 ms
22,708 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 58 ms
22,804 KB
testcase_37 AC 57 ms
22,668 KB
testcase_38 WA -
testcase_39 AC 57 ms
18,704 KB
testcase_40 WA -
testcase_41 AC 58 ms
20,788 KB
testcase_42 AC 57 ms
22,716 KB
testcase_43 AC 58 ms
20,812 KB
testcase_44 AC 58 ms
20,584 KB
testcase_45 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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)
        {
            while (a > h)
            {
                if (a % 2 == 0) { a /= 2; h *= 2; }
                else { b *= 2; h *= 4; }
                count++;
            }
            while (b > 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