主页 讨论版 问题 名次 状态 统计

请自觉遵守比赛规则,违者严惩,不接受求情!

问题 B: Bidirectional Orz Pandas

问题 B: Bidirectional Orz Pandas

时间限制:1000 ms 内存限制:128 MB
提交:102 解决:26
[ 提交][ 状态][ 讨论版]

题目描述

Several Orz Pandas are in a line. However, God Wan is coming from left, while God Big Bread is coming from right. They're both very diaoable so Orz Pandas must hail to both of them.

The captain of Orz Pandas, CupSpirit, has invented a special 0-1 string to solve this problem. Assume S0is an empty string, and

i>0 Si= switch(Si-1)+”1”+reverse(Si-1)

Here “+” means concatenation of strings. reverse(x) means the result of reverting the string x, for example reverse(“100”)=”001”. And switch(x) means every '0' becomes '1' and every '1' becomes '0', for example switch(“100”)=”011”.

Now Captain CupSpirit has selected string SNto determine the direction of all Orz Pandas. If SN[i]=='0', the i-th Orz Panda should hail to God Wan. Otherwise the i-th Orz Panda should hail to God Big Bread. For example, if N = 3, the Orz Pandas would be like

Please determine the direction of K-th Orz Panda.

输入

There are multiple test cases, please process to EOF. For each test case:

The first line contains two integers N and K.

For all test cases, 1N1018, 1≤Kmin(|SN|, 1018)

输出

For each test case, output one line. If this Orz Panda is hailing to God Wan, output “Orz”. Otherwise output “srO”.

样例输入

3 1 3 2 3 3 3 4 3 5 3 6 3 7

样例输出

srO Orz Orz srO srO srO Orz

提示

S1=”1”
S2=”011”
S3=”1001110”

[ 提交][ 状态][ 讨论版]
Baidu
map