結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
nuwasogi
|
| 提出日時 | 2015-11-28 18:39:00 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,352 bytes |
| コンパイル時間 | 1,151 ms |
| コンパイル使用メモリ | 116,764 KB |
| 実行使用メモリ | 25,564 KB |
| 最終ジャッジ日時 | 2024-06-27 13:12:08 |
| 合計ジャッジ時間 | 3,514 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 42 WA * 1 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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 (nb == na) Console.WriteLine(f);
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(); }
}
}
nuwasogi