結果

問題 No.63 ポッキーゲーム
ユーザー _mi_lin__mi_lin_
提出日時 2019-04-09 15:24:56
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 5,000 ms
コード長 1,136 bytes
コンパイル時間 4,562 ms
コンパイル使用メモリ 103,300 KB
実行使用メモリ 24,736 KB
最終ジャッジ日時 2023-09-14 15:51:29
合計ジャッジ時間 4,351 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
22,768 KB
testcase_01 AC 57 ms
20,692 KB
testcase_02 AC 64 ms
24,736 KB
testcase_03 AC 62 ms
22,848 KB
testcase_04 AC 55 ms
20,664 KB
testcase_05 AC 63 ms
22,732 KB
testcase_06 AC 62 ms
22,648 KB
testcase_07 AC 62 ms
22,644 KB
testcase_08 AC 63 ms
22,672 KB
testcase_09 AC 62 ms
20,648 KB
testcase_10 AC 62 ms
22,792 KB
testcase_11 AC 63 ms
22,656 KB
testcase_12 AC 62 ms
24,724 KB
testcase_13 AC 62 ms
22,684 KB
testcase_14 AC 62 ms
22,640 KB
testcase_15 AC 62 ms
22,684 KB
testcase_16 AC 62 ms
22,656 KB
testcase_17 AC 62 ms
22,688 KB
testcase_18 AC 62 ms
24,728 KB
testcase_19 AC 63 ms
22,748 KB
testcase_20 AC 62 ms
24,640 KB
testcase_21 AC 62 ms
22,664 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Text;
using System.Threading.Tasks;

namespace No63Pokkey
{
    class Program
    {
        static void Main(string[] args)
        {
            //整数の入力
            string[] number = Console.ReadLine().Split(' ');

            int L = int.Parse(number[0]);
            int K = int.Parse(number[1]);
            
            //余る場合
            double ans = 0;
            int N = L / K;

            
            if (L%K != 0)
            {
                ans = K * (N / 2);
            }

            //余らない場合
            else if (L%K == 0)
            {
                if (N % 2 == 0)
                {
                    ans = K * (N / 2) - K;
                }
                else if (N % 2 != 0)
                {
                    ans = K * (N / 2);
                }
            }

            //表示
            if (ans <= 0)
            {
                Console.WriteLine("0");
            }
            else
            {
                Console.WriteLine(Math.Floor(ans));
            }

        }
    }
}
0