結果

問題 No.1453 手助け
ユーザー bluemegane
提出日時 2021-04-01 07:10:38
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 796 bytes
コンパイル時間 950 ms
コンパイル使用メモリ 103,680 KB
実行使用メモリ 18,176 KB
最終ジャッジ日時 2024-12-16 09:29:05
合計ジャッジ時間 2,348 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
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
{
    public static int a, b, c, d, e;
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        a = int.Parse(line[0]);
        b = int.Parse(line[1]);
        c = int.Parse(line[2]);
        d = int.Parse(line[3]);
        e = int.Parse(line[4]);
        getAns();
    }
    static void getAns()
    {
        var imax = (b - c) * a;
        if (imax == 0) { Console.WriteLine(0); return; }
        var pre = d;
        var sum = pre;
        for (int i = 2; i <= imax; i++)
        {
            if (i % 10 == 0)
            {
                if (e <= pre) { sum += pre - e; pre = pre - e; }
                else sum += pre;
            }
            else sum += pre;
        }
        Console.WriteLine(sum);
    }
}
0