結果

問題 No.604 誕生日のお小遣い
ユーザー hayashi
提出日時 2019-10-29 10:57:44
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,555 bytes
コンパイル時間 3,634 ms
コンパイル使用メモリ 114,572 KB
実行使用メモリ 28,040 KB
最終ジャッジ日時 2024-09-14 21:25:58
合計ジャッジ時間 4,279 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 static System.Console;
namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] N = ReadLine().Split(' ');
            ulong A = ulong.Parse(N[0]);
            ulong B = ulong.Parse(N[1]);
            ulong C = ulong.Parse(N[2]);
            ulong count = 0;
            ulong ans = 0;
            ulong i = 0;
            ulong j = 0;
            
            if(A == 1 && B == 1 || B == 1)
            {
                WriteLine(C);
                return;
            }
            if(A == B && A == C && B == C)
            {
                WriteLine(C);
                return;
            }
            i = C / A;
            if(B * i == C && A == B)
            {
                ans += (i - 1) * 2;
                WriteLine(ans);
                return;
            }
            else if(B * i > C)
            {
                if(A + B == C)
                {
                    ans += i + A - 1;
                    WriteLine(ans);
                    return;
                }
                ans += i + A - 2;
                WriteLine(ans);
                return;
            }
            else if(B * i <= C)
            {
                if(A > B && B != 1)
                {
                    ans += i + A + (A - B);
                    WriteLine(ans);
                    return;
                }
                ans += i + A;
                WriteLine(ans);
                return;
            }
        }
    }
}
0