結果

問題 No.846 メダル
ユーザー bluemegane
提出日時 2021-11-07 09:49:44
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 979 bytes
コンパイル時間 4,220 ms
コンパイル使用メモリ 103,936 KB
実行使用メモリ 18,816 KB
最終ジャッジ日時 2024-11-08 20:29:08
合計ジャッジ時間 6,011 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Collections.Generic;
using System.Linq;
using System;

public class Hello
{
    public static long p, q, r, a, b, c;
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        p = long.Parse(line[0]);
        q = long.Parse(line[1]);
        r = long.Parse(line[2]);

        line = Console.ReadLine().Trim().Split(' ');
        a = long.Parse(line[0]);
        b = long.Parse(line[1]);
        c = long.Parse(line[2]);
        getAns();
    }
    static void getAns()
    {
        var min = new List<long>();
        var max = new List<long>();
        min.Add((a - 1L) * p + 1L);
        max.Add(p * a);
        min.Add((b - 1L + a) * q + 1L);
        max.Add((b + a) * q);
        min.Add((c - 1L + a + b) * r + 1L);
        max.Add((a + b + c) * r);
        var ans1 = min.Max();
        var ans2 = max.Min();
        if (ans1 > ans2) Console.WriteLine(-1);
        else Console.WriteLine("{0} {1}", ans1, ans2);
    }
}
0