結果

問題 No.197 手品
ユーザー nuwasoginuwasogi
提出日時 2015-11-28 18:43:28
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 55 ms / 1,000 ms
コード長 3,412 bytes
コンパイル時間 2,515 ms
コンパイル使用メモリ 108,360 KB
実行使用メモリ 22,792 KB
最終ジャッジ日時 2023-09-27 09:36:37
合計ジャッジ時間 6,867 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
20,644 KB
testcase_01 AC 51 ms
22,680 KB
testcase_02 AC 52 ms
20,656 KB
testcase_03 AC 51 ms
20,628 KB
testcase_04 AC 51 ms
20,732 KB
testcase_05 AC 52 ms
20,628 KB
testcase_06 AC 53 ms
20,576 KB
testcase_07 AC 52 ms
20,632 KB
testcase_08 AC 52 ms
20,648 KB
testcase_09 AC 50 ms
22,676 KB
testcase_10 AC 50 ms
20,660 KB
testcase_11 AC 51 ms
20,652 KB
testcase_12 AC 53 ms
20,744 KB
testcase_13 AC 49 ms
20,632 KB
testcase_14 AC 49 ms
20,744 KB
testcase_15 AC 48 ms
20,632 KB
testcase_16 AC 52 ms
20,576 KB
testcase_17 AC 53 ms
20,644 KB
testcase_18 AC 50 ms
20,644 KB
testcase_19 AC 50 ms
20,792 KB
testcase_20 AC 51 ms
18,568 KB
testcase_21 AC 52 ms
20,776 KB
testcase_22 AC 54 ms
20,636 KB
testcase_23 AC 52 ms
20,632 KB
testcase_24 AC 53 ms
20,644 KB
testcase_25 AC 53 ms
22,792 KB
testcase_26 AC 55 ms
22,696 KB
testcase_27 AC 53 ms
22,780 KB
testcase_28 AC 50 ms
20,632 KB
testcase_29 AC 49 ms
20,632 KB
testcase_30 AC 51 ms
20,740 KB
testcase_31 AC 53 ms
20,680 KB
testcase_32 AC 53 ms
20,640 KB
testcase_33 AC 53 ms
20,676 KB
testcase_34 AC 52 ms
20,636 KB
testcase_35 AC 50 ms
20,576 KB
testcase_36 AC 53 ms
20,736 KB
testcase_37 AC 53 ms
20,648 KB
testcase_38 AC 53 ms
22,696 KB
testcase_39 AC 53 ms
20,592 KB
testcase_40 AC 52 ms
20,576 KB
testcase_41 AC 50 ms
20,800 KB
testcase_42 AC 50 ms
20,612 KB
testcase_43 AC 51 ms
20,752 KB
testcase_44 AC 49 ms
20,716 KB
testcase_45 AC 49 ms
18,604 KB
testcase_46 AC 52 ms
20,760 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;
using System.Collections;

namespace Tejina_CS
{
    class Program
    {
        static void Main(string[] args)
        {
            Solution sol = new Solution();
            sol.Solve();
        }

    }

    class Solution
    {
        bool[] Cba = new bool[3]; // true コインあり, false コイン無し
        bool[] Caa = new bool[3];

        static bool[] b4 = { false, true, false };
        static bool[] b5 = { true, false, true };

        int N;
        int nb = 0, na = 0;
        string s = "SUCCESS", f = "FAILURE";

        public void Solve()
        {
            if (nb != na)
            {
                Console.WriteLine(s);
            }
            else
            {
                switch (N)
                {
                    case 0:
                        if (BEquals(Cba, Caa)) Console.WriteLine(f);
                        else Console.WriteLine(s);
                        break;
                    case 1:
                        bool b4r = BEquals(b4, BAnd(Cba, Caa));
                        bool b5r = BEquals(b5, BOr(Cba,Caa));
                        if (b4r || b5r) Console.WriteLine(s);
                        else Console.WriteLine(f);
                        break;
                    default:
                        Console.WriteLine(f);
                        break;
                }
            }
        }

        public Solution()
        {
            string Sbefore = rs();
            N = ri();
            string Safter = rs();

            for (int i = 0; i < Cba.Length; i++)
            {
                if (Sbefore[i] == 'o')
                {
                    Cba[i] = true;
                    nb++;
                }
            }
            for (int i = 0; i < Caa.Length; i++)
            {
                if (Safter[i] == 'o')
                {
                    Caa[i] = true;
                    na++;
                }
            }
        }

        public static bool BEquals(bool[] x, bool[] y)
        {
            for (int i = 0; i < x.Length; i++)
                if (x[i] != y[i]) return false;
            return true;
        }
        public static bool[] BAnd(bool[] x, bool[] y)
        {
            bool[] ret = new bool[3];
            for(int i=0; i<ret.Length; i++)
            {
                ret[i] = x[i] & y[i];
            }
            return ret;
        }
        public static bool[] BOr(bool[] x, bool[] y)
        {
            bool[] ret = new bool[3];
            for (int i = 0; i < ret.Length; i++)
            {
                ret[i] = x[i] | y[i];
            }
            return ret;
        }

        static String rs() { return Console.ReadLine(); }
        static int ri() { return int.Parse(Console.ReadLine()); }
        static long rl() { return long.Parse(Console.ReadLine()); }
        static double rd() { return double.Parse(Console.ReadLine()); }
        static String[] rsa() { return Console.ReadLine().Split(' '); }
        static int[] ria() { return Console.ReadLine().Split(' ').Select(e => int.Parse(e)).ToArray(); }
        static long[] rla() { return Console.ReadLine().Split(' ').Select(e => long.Parse(e)).ToArray(); }
        static double[] rda() { return Console.ReadLine().Split(' ').Select(e => double.Parse(e)).ToArray(); }
    }
}
0