結果
| 問題 | 
                            No.197 手品
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-08-27 23:32:31 | 
| 言語 | C#(csc)  (csc 3.9.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 24 ms / 1,000 ms | 
| コード長 | 1,290 bytes | 
| コンパイル時間 | 3,471 ms | 
| コンパイル使用メモリ | 110,592 KB | 
| 実行使用メモリ | 17,664 KB | 
| 最終ジャッジ日時 | 2024-07-20 03:49:23 | 
| 合計ジャッジ時間 | 3,420 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 43 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
class Magic
{
	static void Main(String[] args)
	{
		String Sbefore;
		long N;
		String Safter;
		Sbefore = Console.ReadLine();
		N = long.Parse(Console.ReadLine());
		Safter = Console.ReadLine();
		int cb = CountCoins(Sbefore);
		int ca = CountCoins(Safter);
		if(cb != ca)
		{
			Console.WriteLine("SUCCESS");
			return;
		}
		if(cb == 0 || cb == 3)
		{
			Console.WriteLine("FAILURE");
			return;
		}
		if(N >= 2)
		{
			Console.WriteLine("FAILURE");
			return;
		}
		if(N == 1)
		{
			if(SwapCmp(Sbefore, Safter))
			{
				Console.WriteLine("FAILURE");
				return;
			}
			else
			{
				Console.WriteLine("SUCCESS");
				return;
			}
		}
		if(N == 0)
		{
			if(Sbefore == Safter)
			{
				Console.WriteLine("FAILURE");
				return;
			}
			else
			{
				Console.WriteLine("SUCCESS");
				return;
			}
		}
	}
	static int CountCoins(String S)
	{
		int ret = 0;
		foreach(char c in S)
		{
			if(c == 'o')
				ret++;
		}
		return ret;
	}
	static bool SwapCmp(String b, String a)
	{
		char[] buff = new char[3];
		
		buff[0] = b[1];
		buff[1] = b[0];
		buff[2] = b[2];
		String s1 = new String(buff);
		if(s1 == a)
			return true;
		buff[0] = b[0];
		buff[1] = b[2];
		buff[2] = b[1];
		String s2 = new String(buff);
		if(s2 == a)
			return true;
		return false;
	}
}