結果

問題 No.2208 Linear Function
ユーザー srue1098srue1098
提出日時 2023-02-13 22:42:28
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 950 bytes
コンパイル時間 9,387 ms
コンパイル使用メモリ 146,132 KB
実行使用メモリ 164,212 KB
最終ジャッジ日時 2023-09-23 14:06:18
合計ジャッジ時間 10,351 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
28,768 KB
testcase_01 AC 56 ms
28,728 KB
testcase_02 AC 56 ms
29,040 KB
testcase_03 AC 56 ms
164,212 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  Determining projects to restore...
  Restored /home/judge/data/code/main.csproj (in 210 ms).
.NET 向け Microsoft (R) Build Engine バージョン 17.0.0-preview-21470-01+cb055d28f
Copyright (C) Microsoft Corporation.All rights reserved.

  プレビュー版の .NET を使用しています。https://aka.ms/dotnet-core-preview をご覧ください
  main -> /home/judge/data/code/bin/Release/net6.0/main.dll
  main -> /home/judge/data/code/bin/Release/net6.0/publish/

ソースコード

diff #

using System;

class Program
{
    static void Main()
    {
        int T = int.Parse(Console.ReadLine());
        
        string[][] cases = new string[T][];
        
        int[] L = new int[T];
        int[] R = new int[T];
        int[] A = new int[T];
        int[] B = new int[T];
        
        
        for(int i=0; i<T; i++)
        {
            cases[i] = Console.ReadLine().Split(' ');
            L[i] = int.Parse(cases[i][0]);
            R[i] = int.Parse(cases[i][1]);
            A[i] = int.Parse(cases[i][2]);
            B[i] = int.Parse(cases[i][3]);
        }
        
        int[] Max = new int[T];
        
        for(int i=0; i<T; i++)
        {
            if(A[i] < 0)
            {
                Max[i] = A[i] * L[i] + B[i];
            }
            
            else
            {
                Max[i] = A[i] * R[i] + B[i];
            }
            Console.WriteLine(Max[i]);
        }
        
        
    }
}
0