結果

問題 No.63 ポッキーゲーム
ユーザー _mi_lin_
提出日時 2019-04-09 15:24:56
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 1,136 bytes
コンパイル時間 831 ms
コンパイル使用メモリ 109,452 KB
実行使用メモリ 26,812 KB
最終ジャッジ日時 2024-07-01 23:01:25
合計ジャッジ時間 2,225 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
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