結果

問題 No.338 アンケート機能
ユーザー huffman56
提出日時 2022-11-06 09:57:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 1,064 bytes
コンパイル時間 2,812 ms
コンパイル使用メモリ 104,448 KB
実行使用メモリ 19,456 KB
最終ジャッジ日時 2024-07-20 00:53:02
合計ジャッジ時間 2,997 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using static System.Math;

namespace SortItems
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine().Split().Select(double.Parse).ToArray();
            double A = n[0];
            double B = n[1];

            for (var a = 0; a <= 200; a++)
            {
                var chk = false;

                for (var b = 0; a + b <= 200; b++)
                {
                    double x = Math.Round((100 * (double)a) / (a + b) , MidpointRounding.AwayFromZero);
                    double y = Math.Round((100 * (double)b) / (a + b) , MidpointRounding.AwayFromZero);

                    if (x == A && y == B)
                    {
                        chk = true;
                        Console.WriteLine(a + b);
                        break;
                    }
                }

                if (chk)
                {
                    break;
                }

            }

        }
    }
}
0