結果

問題 No.197 手品
ユーザー horiesiniti
提出日時 2017-06-27 05:55:37
言語 Ruby
(3.4.1)
結果
AC  
実行時間 103 ms / 1,000 ms
コード長 336 bytes
コンパイル時間 44 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-07-20 03:52:39
合計ジャッジ時間 5,716 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def f(s,a,b,c)
	return s[a]+s[b]+s[c]
end

a=gets.chomp
n=gets.to_i

s=[]
if n%2==0 then
	s<<a
end
if n>0 && (n-1)%2==0 then
	s<<f(a,0,2,1)
	s<<f(a,1,0,2)
end
if n>1 && (n-2)%2==0 then
	s<<f(a,1,2,0)
	s<<f(a,2,0,1)
end
if n>2 && (n-3)%2==0 then
	s<<f(a,2,1,0)
end
b=gets.chomp
if s.index(b) then
	puts "FAILURE"
else
	puts "SUCCESS"
end
0