結果

問題 No.5003 物理好きクリッカー
ユーザー vis103vis103
提出日時 2018-12-11 11:27:52
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 404 ms / 10,000 ms
コード長 21,749 bytes
コンパイル時間 896 ms
実行使用メモリ 33,652 KB
スコア 3,246,478
平均クエリ数 10000.00
最終ジャッジ日時 2021-07-19 09:21:23
合計ジャッジ時間 16,273 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 404 ms
33,244 KB
testcase_01 AC 403 ms
33,356 KB
testcase_02 AC 386 ms
33,132 KB
testcase_03 AC 364 ms
33,432 KB
testcase_04 AC 354 ms
33,068 KB
testcase_05 AC 398 ms
33,188 KB
testcase_06 AC 385 ms
33,144 KB
testcase_07 AC 398 ms
33,308 KB
testcase_08 AC 399 ms
33,368 KB
testcase_09 AC 383 ms
33,284 KB
testcase_10 AC 373 ms
33,132 KB
testcase_11 AC 376 ms
33,284 KB
testcase_12 AC 400 ms
33,416 KB
testcase_13 AC 365 ms
33,244 KB
testcase_14 AC 356 ms
33,324 KB
testcase_15 AC 358 ms
33,396 KB
testcase_16 AC 390 ms
33,056 KB
testcase_17 AC 358 ms
33,468 KB
testcase_18 AC 369 ms
33,280 KB
testcase_19 AC 403 ms
33,112 KB
testcase_20 AC 400 ms
33,140 KB
testcase_21 AC 396 ms
33,168 KB
testcase_22 AC 402 ms
33,440 KB
testcase_23 AC 399 ms
33,236 KB
testcase_24 AC 397 ms
33,208 KB
testcase_25 AC 358 ms
33,456 KB
testcase_26 AC 350 ms
33,288 KB
testcase_27 AC 399 ms
33,016 KB
testcase_28 AC 345 ms
33,208 KB
testcase_29 AC 347 ms
33,392 KB
testcase_30 AC 355 ms
33,500 KB
testcase_31 AC 364 ms
33,304 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.6.0-4.20224.5 (ec77c100)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static Equipment[] eq = new Equipment[5];
    static int nowTurn = 0;
    static int SevenTimesTurn = 0;
    static string SpecialFactor;

    static void Main(string[] args)
    {
        int Turn = int.Parse(Console.ReadLine());
        SpecialFactor = Console.ReadLine();
        
        eq[0] = new Equipment();
        eq[0].Name = "hand";
        eq[0].Buy = 150;
        eq[0].Product = 1;
        eq[0].Reinforce = 1500;

        eq[1] = new Equipment();
        eq[1].Name = "lily";
        eq[1].Buy = 2000;
        eq[1].Product = 10;
        eq[1].Reinforce = 20000;

        eq[2] = new Equipment();
        eq[2].Name = "factory";
        eq[2].Buy = 30000;
        eq[2].Product = 120;
        eq[2].Reinforce = 300000;

        eq[3] = new Equipment();
        eq[3].Name = "casino";
        eq[3].Buy = 600000;
        eq[3].Product = 2000;
        eq[3].Reinforce = 6000000;

        eq[4] = new Equipment();
        eq[4].Name = "grimoire";
        eq[4].Buy = 10000000;
        eq[4].Product = 25000;
        eq[4].Reinforce = 100000000;
        
        int Cookies = 0;
        bool buyHandflg = false;

        for(; nowTurn < Turn || nowTurn < 200; nowTurn++)
        {
            if (Cookies >= 15 && !buyHandflg)
            {
                Console.WriteLine("enhclick");
                Console.ReadLine();
                Cookies -= 15;
                Cookies += GetProducts();

                buyHandflg = true;
                if (SpecialFactor.Substring(nowTurn, 1) == "B")
                {
                    Cookies += (int)Math.Floor(Cookies * 0.01);
                }
                continue;
            }
            else if (Cookies >= eq[0].Buy)
            {
                Console.WriteLine("buy hand");
                Console.ReadLine();

                Cookies -= eq[0].Buy;
                eq[0].Buy = (int)Math.Ceiling((double)eq[0].Buy * 1.2);
                eq[0].Count++;
                Cookies += GetProducts();
                if (SpecialFactor.Substring(nowTurn, 1) == "B")
                {
                    Cookies += (int)Math.Floor(Cookies * 0.01);
                }

                continue;
            }
            else
            {
                Console.WriteLine("click");
                Console.ReadLine();
                if(buyHandflg)
                {
                    Cookies++;
                }
                else
                {
                    Cookies++;
                    Cookies++;
                }

                if (SpecialFactor.Substring(nowTurn, 1) == "B")
                {
                    Cookies += (int)Math.Floor(Cookies * 0.01);
                }
                Cookies += GetProducts();
                continue;
            }

        }


        for (; nowTurn < Turn; nowTurn++)
        {
            try
            {
                if (SpecialFactor.Substring(nowTurn, 1) == "F")
                {
                    SevenTimesTurn = 21;
                }

                // 最後のsell判断
                if (eq[0].Count + eq[1].Count + eq[2].Count + eq[3].Count + eq[4].Count >= Turn - nowTurn)
                {
                    if (0 < eq[0].Count)
                    {
                        Console.WriteLine("sell " + eq[0].Name);
                        Console.ReadLine();
                        continue;
                    }
                    else if (0 < eq[1].Count)
                    {
                        Console.WriteLine("sell " + eq[1].Name);
                        Console.ReadLine();
                        continue;
                    }
                    else if (0 < eq[2].Count)
                    {
                        Console.WriteLine("sell " + eq[2].Name);
                        Console.ReadLine();
                        continue;
                    }
                    else if (0 < eq[3].Count)
                    {
                        Console.WriteLine("sell " + eq[3].Name);
                        Console.ReadLine();
                        continue;
                    }
                    else if (0 < eq[4].Count)
                    {
                        Console.WriteLine("sell " + eq[4].Name);
                        Console.ReadLine();
                        continue;
                    }
                }
                else if (eq[0].Count + eq[1].Count + eq[2].Count + eq[3].Count + eq[4].Count >= Turn - nowTurn - 200)
                {
                    // 後半買わないでクリック
                    Console.WriteLine("click");
                    Console.ReadLine();
                    continue;
                }

                if (eq[0].Count * eq[0].Product / eq[0].Reinforce <= eq[0].Product / eq[0].Buy &&
                   eq[0].Count * eq[0].Product / eq[0].Reinforce <= eq[0].Product / eq[0].Buy &&
                   eq[1].Product / eq[1].Buy <= eq[0].Product / eq[0].Buy &&
                   eq[1].Count * eq[1].Product / eq[1].Reinforce <= eq[0].Product / eq[0].Buy &&
                   eq[2].Product / eq[2].Buy <= eq[0].Product / eq[0].Buy &&
                   eq[2].Count * eq[2].Product / eq[2].Reinforce <= eq[0].Product / eq[0].Buy &&
                   eq[3].Product / eq[3].Buy <= eq[0].Product / eq[0].Buy &&
                   eq[3].Count * eq[3].Product / eq[3].Reinforce <= eq[0].Product / eq[0].Buy &&
                   eq[4].Product / eq[4].Buy <= eq[0].Product / eq[0].Buy &&
                   eq[4].Count * eq[4].Product / eq[4].Reinforce <= eq[0].Product / eq[0].Buy &&
                   eq[0].Buy <= Cookies)
                {
                    Console.WriteLine("buy " + eq[0].Name);
                    Console.ReadLine();
                    if(SpecialFactor.Substring(nowTurn, 1) == "S")
                    {
                        Cookies -= (int)Math.Ceiling(eq[0].Buy * 0.9);
                    }
                    else
                    {
                        Cookies -= eq[0].Buy;
                    }
                    eq[0].Buy = (int)Math.Ceiling((double)eq[0].Buy * 1.2);
                    eq[0].Count++;
                    
                    continue;
                }
                else if (eq[0].Product / eq[0].Buy <= eq[0].Count * eq[0].Product / eq[0].Reinforce &&
                         eq[1].Product / eq[1].Buy <= eq[0].Count * eq[0].Product / eq[0].Reinforce &&
                         eq[1].Count * eq[1].Product / eq[1].Reinforce <= eq[0].Count * eq[0].Product / eq[0].Reinforce &&
                         eq[2].Product / eq[2].Buy <= eq[0].Count * eq[0].Product / eq[0].Reinforce &&
                         eq[2].Count * eq[2].Product / eq[2].Reinforce <= eq[0].Count * eq[0].Product / eq[0].Reinforce &&
                         eq[3].Product / eq[3].Buy <= eq[0].Count * eq[0].Product / eq[0].Reinforce &&
                         eq[3].Count * eq[3].Product / eq[3].Reinforce <= eq[0].Count * eq[0].Product / eq[0].Reinforce &&
                         eq[4].Product / eq[4].Buy <= eq[0].Count * eq[0].Product / eq[0].Reinforce &&
                         eq[4].Count * eq[4].Product / eq[4].Reinforce <= eq[0].Count * eq[0].Product / eq[0].Reinforce &&
                         eq[0].Reinforce <= Cookies)
                {
                    Console.WriteLine("reinforce " + eq[0].Name);
                    Console.ReadLine();

                    if (SpecialFactor.Substring(nowTurn, 1) == "S")
                    {
                        Cookies -= (int)Math.Ceiling(eq[0].Reinforce * 0.9);
                    }
                    else
                    {
                        Cookies -= eq[0].Reinforce;
                    }
                    eq[0].Reinforce = eq[0].Reinforce * 10;
                    eq[0].Product *= 2;
                    
                    continue;
                }
                else if (eq[0].Product / eq[0].Buy <= eq[1].Product / eq[1].Buy &&
                         eq[0].Count * eq[0].Product / eq[0].Reinforce <= eq[1].Product / eq[1].Buy &&
                         eq[1].Count * eq[1].Product / eq[1].Reinforce <= eq[1].Product / eq[1].Buy &&
                         eq[2].Product / eq[2].Buy <= eq[1].Product / eq[1].Buy &&
                         eq[2].Count * eq[2].Product / eq[2].Reinforce <= eq[1].Product / eq[1].Buy &&
                         eq[3].Product / eq[3].Buy <= eq[1].Product / eq[1].Buy &&
                         eq[3].Count * eq[3].Product / eq[3].Reinforce <= eq[1].Product / eq[1].Buy &&
                         eq[4].Product / eq[4].Buy <= eq[1].Product / eq[1].Buy &&
                         eq[4].Count * eq[4].Product / eq[4].Reinforce <= eq[1].Product / eq[1].Buy &&
                         eq[1].Buy <= Cookies)
                {
                    Console.WriteLine("buy " + eq[1].Name);
                    Console.ReadLine();

                    if (SpecialFactor.Substring(nowTurn, 1) == "S")
                    {
                        Cookies -= (int)Math.Ceiling(eq[1].Buy * 0.9);
                    }
                    else
                    {
                        Cookies -= eq[1].Buy;
                    }
                    eq[1].Buy = (int)Math.Ceiling((double)eq[1].Buy * 1.2);
                    eq[1].Count++;
                    
                    continue;
                }
                else if (eq[0].Product / eq[0].Buy <= eq[1].Count * eq[1].Product / eq[1].Reinforce &&
                         eq[0].Count * eq[0].Product / eq[0].Reinforce <= eq[1].Count * eq[1].Product / eq[1].Reinforce &&
                         eq[1].Product / eq[1].Buy <= eq[1].Count * eq[1].Product / eq[1].Reinforce &&
                         eq[2].Product / eq[2].Buy <= eq[1].Count * eq[1].Product / eq[1].Reinforce &&
                         eq[2].Count * eq[2].Product / eq[2].Reinforce <= eq[1].Count * eq[1].Product / eq[1].Reinforce &&
                         eq[3].Product / eq[3].Buy <= eq[1].Count * eq[1].Product / eq[1].Reinforce &&
                         eq[3].Count * eq[3].Product / eq[3].Reinforce <= eq[1].Count * eq[1].Product / eq[1].Reinforce &&
                         eq[4].Product / eq[4].Buy <= eq[1].Count * eq[1].Product / eq[1].Reinforce &&
                         eq[4].Count * eq[4].Product / eq[4].Reinforce <= eq[1].Count * eq[1].Product / eq[1].Reinforce &&
                         eq[1].Reinforce <= Cookies)
                {
                    Console.WriteLine("reinforce " + eq[1].Name);
                    Console.ReadLine();
                    
                    if (SpecialFactor.Substring(nowTurn, 1) == "S")
                    {
                        Cookies -= (int)Math.Ceiling(eq[1].Reinforce * 0.9);
                    }
                    else
                    {
                        Cookies -= eq[1].Reinforce;
                    }
                    eq[1].Reinforce = eq[1].Reinforce * 10;
                    eq[1].Product *= 2;
                    
                    continue;
                }
                else if (eq[0].Product / eq[0].Buy <= eq[2].Product / eq[2].Buy &&
                         eq[0].Count * eq[0].Product / eq[0].Reinforce <= eq[2].Product / eq[2].Buy &&
                         eq[1].Product / eq[1].Buy <= eq[2].Product / eq[2].Buy &&
                         eq[1].Count * eq[1].Product / eq[1].Reinforce <= eq[2].Product / eq[2].Buy &&
                         eq[2].Count * eq[2].Product / eq[2].Reinforce <= eq[2].Product / eq[2].Buy &&
                         eq[3].Product / eq[3].Buy <= eq[2].Product / eq[2].Buy &&
                         eq[3].Count * eq[3].Product / eq[3].Reinforce <= eq[2].Product / eq[2].Buy &&
                         eq[4].Product / eq[4].Buy <= eq[2].Product / eq[2].Buy &&
                         eq[4].Count * eq[4].Product / eq[4].Reinforce <= eq[2].Product / eq[2].Buy &&
                         eq[2].Buy <= Cookies)
                {
                    Console.WriteLine("buy " + eq[2].Name);
                    Console.ReadLine();
                    
                    if (SpecialFactor.Substring(nowTurn, 1) == "S")
                    {
                        Cookies -= (int)Math.Ceiling(eq[2].Buy * 0.9);
                    }
                    else
                    {
                        Cookies -= eq[2].Buy;
                    }
                    eq[2].Buy = (int)Math.Ceiling((double)eq[2].Buy * 1.2);
                    eq[2].Count++;
                    
                    continue;
                }
                else if (eq[0].Product / eq[0].Buy <= eq[2].Count * eq[2].Product / eq[2].Reinforce &&
                         eq[0].Count * eq[0].Product / eq[0].Reinforce <= eq[2].Count * eq[2].Product / eq[2].Reinforce &&
                         eq[1].Product / eq[1].Buy <= eq[2].Count * eq[2].Product / eq[2].Reinforce &&
                         eq[1].Count * eq[1].Product / eq[1].Reinforce <= eq[2].Count * eq[2].Product / eq[2].Reinforce &&
                         eq[2].Product / eq[2].Buy <= eq[2].Count * eq[2].Product / eq[2].Reinforce &&
                         eq[3].Product / eq[3].Buy <= eq[2].Count * eq[2].Product / eq[2].Reinforce &&
                         eq[3].Count * eq[3].Product / eq[3].Reinforce <= eq[2].Count * eq[2].Product / eq[2].Reinforce &&
                         eq[4].Product / eq[4].Buy <= eq[2].Count * eq[2].Product / eq[2].Reinforce &&
                         eq[4].Count * eq[4].Product / eq[4].Reinforce <= eq[2].Count * eq[2].Product / eq[2].Reinforce &&
                         eq[2].Reinforce <= Cookies)
                {
                    Console.WriteLine("reinforce " + eq[2].Name);
                    Console.ReadLine();
                    
                    if (SpecialFactor.Substring(nowTurn, 1) == "S")
                    {
                        Cookies -= (int)Math.Ceiling(eq[2].Reinforce * 0.9);
                    }
                    else
                    {
                        Cookies -= eq[2].Reinforce;
                    }
                    eq[2].Reinforce = eq[2].Reinforce * 10;
                    eq[2].Product *= 2;
                    
                    continue;
                }
                else if (eq[0].Product / eq[0].Buy <= eq[3].Product / eq[3].Buy &&
                         eq[0].Count * eq[0].Product / eq[0].Reinforce <= eq[3].Product / eq[3].Buy &&
                         eq[1].Product / eq[1].Buy <= eq[3].Product / eq[3].Buy &&
                         eq[1].Count * eq[1].Product / eq[1].Reinforce <= eq[3].Product / eq[3].Buy &&
                         eq[2].Product / eq[2].Buy <= eq[3].Product / eq[3].Buy &&
                         eq[2].Count * eq[2].Product / eq[2].Reinforce <= eq[3].Product / eq[3].Buy &&
                         eq[3].Count * eq[3].Product / eq[3].Reinforce <= eq[3].Product / eq[3].Buy &&
                         eq[4].Product / eq[4].Buy <= eq[3].Product / eq[3].Buy &&
                         eq[4].Count * eq[4].Product / eq[4].Reinforce <= eq[3].Product / eq[3].Buy &&
                         eq[3].Buy <= Cookies)
                {
                    Console.WriteLine("buy " + eq[3].Name);
                    Console.ReadLine();

                    if (SpecialFactor.Substring(nowTurn, 1) == "S")
                    {
                        Cookies -= (int)Math.Ceiling(eq[3].Buy * 0.9);
                    }
                    else
                    {
                        Cookies -= eq[3].Buy;
                    }
                    eq[3].Buy = (int)Math.Ceiling((double)eq[3].Buy * 1.2);
                    eq[3].Count++;
                    
                    continue;
                }
                else if (eq[0].Product / eq[0].Buy <= eq[3].Count * eq[3].Product / eq[3].Reinforce &&
                         eq[0].Count * eq[0].Product / eq[0].Reinforce <= eq[3].Count * eq[3].Product / eq[3].Reinforce &&
                         eq[1].Product / eq[1].Buy <= eq[3].Count * eq[3].Product / eq[3].Reinforce &&
                         eq[1].Count * eq[1].Product / eq[1].Reinforce <= eq[3].Count * eq[3].Product / eq[3].Reinforce &&
                         eq[2].Product / eq[2].Buy <= eq[3].Count * eq[3].Product / eq[3].Reinforce &&
                         eq[2].Count * eq[2].Product / eq[2].Reinforce <= eq[3].Count * eq[3].Product / eq[3].Reinforce &&
                         eq[3].Product / eq[3].Buy <= eq[3].Count * eq[3].Product / eq[3].Reinforce &&
                         eq[4].Product / eq[4].Buy <= eq[3].Count * eq[3].Product / eq[3].Reinforce &&
                         eq[4].Count * eq[4].Product / eq[4].Reinforce <= eq[3].Count * eq[3].Product / eq[3].Reinforce &&
                         eq[3].Reinforce <= Cookies)
                {
                    Console.WriteLine("reinforce " + eq[3].Name);
                    Console.ReadLine();

                    if (SpecialFactor.Substring(nowTurn, 1) == "S")
                    {
                        Cookies -= (int)Math.Ceiling(eq[3].Reinforce * 0.9);
                    }
                    else
                    {
                        Cookies -= eq[3].Reinforce;
                    }
                    eq[3].Reinforce = eq[3].Reinforce * 10;
                    eq[3].Product *= 2;
                    
                    continue;
                }
                else if (eq[0].Product / eq[0].Buy <= eq[4].Product / eq[4].Buy &&
                         eq[0].Count * eq[0].Product / eq[0].Reinforce <= eq[4].Product / eq[4].Buy &&
                         eq[1].Product / eq[1].Buy <= eq[4].Product / eq[4].Buy &&
                         eq[1].Count * eq[1].Product / eq[1].Reinforce <= eq[4].Product / eq[4].Buy &&
                         eq[2].Product / eq[2].Buy <= eq[4].Product / eq[4].Buy &&
                         eq[2].Count * eq[2].Product / eq[2].Reinforce <= eq[4].Product / eq[4].Buy &&
                         eq[3].Product / eq[3].Buy <= eq[4].Product / eq[4].Buy &&
                         eq[3].Count * eq[3].Product / eq[3].Reinforce <= eq[4].Product / eq[4].Buy &&
                         eq[4].Count * eq[4].Product / eq[4].Reinforce <= eq[4].Product / eq[4].Buy &&
                         eq[4].Buy <= Cookies)
                {
                    Console.WriteLine("buy " + eq[4].Name);
                    Console.ReadLine();

                    if (SpecialFactor.Substring(nowTurn, 1) == "S")
                    {
                        Cookies -= (int)Math.Ceiling(eq[4].Buy * 0.9);
                    }
                    else
                    {
                        Cookies -= eq[4].Buy;
                    }
                    eq[4].Buy = (int)Math.Ceiling((double)eq[4].Buy * 1.2);
                    eq[4].Count++;
                    
                    continue;
                }
                else if (eq[0].Product / eq[0].Buy <= eq[4].Count * eq[4].Product / eq[4].Reinforce &&
                         eq[0].Count * eq[0].Product / eq[0].Reinforce <= eq[4].Count * eq[4].Product / eq[4].Reinforce &&
                         eq[1].Product / eq[1].Buy <= eq[4].Count * eq[4].Product / eq[4].Reinforce &&
                         eq[1].Count * eq[1].Product / eq[1].Reinforce <= eq[4].Count * eq[4].Product / eq[4].Reinforce &&
                         eq[2].Product / eq[2].Buy <= eq[4].Count * eq[4].Product / eq[4].Reinforce &&
                         eq[2].Count * eq[2].Product / eq[2].Reinforce <= eq[4].Count * eq[4].Product / eq[4].Reinforce &&
                         eq[3].Product / eq[3].Buy <= eq[4].Count * eq[4].Product / eq[4].Reinforce &&
                         eq[3].Count * eq[3].Product / eq[3].Reinforce <= eq[4].Count * eq[4].Product / eq[4].Reinforce &&
                         eq[4].Product / eq[4].Buy <= eq[4].Count * eq[4].Product / eq[4].Reinforce &&
                         eq[4].Reinforce <= Cookies)
                {
                    Console.WriteLine("reinforce " + eq[4].Name);
                    Console.ReadLine();

                    if (SpecialFactor.Substring(nowTurn, 1) == "S")
                    {
                        Cookies -= (int)Math.Ceiling(eq[4].Reinforce * 0.9);
                    }
                    else
                    {
                        Cookies -= eq[4].Reinforce;
                    }
                    eq[4].Reinforce = eq[4].Reinforce * 10;
                    eq[4].Product *= 2;
                    continue;
                }
                
                Console.WriteLine("click");
                Console.ReadLine();
                Cookies++;
                Cookies++;
            }
            catch
            {

            }
            finally
            {
                if(SpecialFactor.Substring(nowTurn, 1) == "B")
                {
                    Cookies += (int)Math.Floor(Cookies * 0.01);
                }

                Cookies += GetProducts();

            }
        }    
    }

    private static int GetProducts()
    {
        SevenTimesTurn--;
        return 0 < SevenTimesTurn ? 
            (eq[0].Product * eq[0].Count + eq[1].Product * eq[1].Count + eq[2].Product * eq[2].Count + eq[3].Product * eq[3].Count + eq[4].Product * eq[4].Count) * 7 
            : eq[0].Product * eq[0].Count + eq[1].Product * eq[1].Count + eq[2].Product * eq[2].Count + eq[3].Product * eq[3].Count + eq[4].Product * eq[4].Count;
    }

}

class Equipment
{
    public string Name { get; set; }
    public int Buy = 0;
    public int Product = 0;
    public int Reinforce = 0;
    public int Count = 0;
}
0