http://codeforces.com/contest/918/problem/A
A. Eleven
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters.
Her friend suggested that her name should only consist of uppercase and lowercase letters ‘O’. More precisely, they suggested that the i-th letter of her name should be ‘O’ (uppercase) if i is a member of Fibonacci sequence, and ‘o’ (lowercase) otherwise. The letters in the name are numbered from 1 to n. Fibonacci sequence is the sequence f where
f1 = 1,
f2 = 1,
fn = fn - 2 + fn - 1 (n > 2).
As her friends are too young to know what Fibonacci sequence is, they asked you to help Eleven determine her new name.
Input
The first and only line of input contains an integer n (1 ≤ n ≤ 1000).
Output
Print Eleven’s new name on the first and only line of output.
Examples
input
8
output
OOOoOooO
input
15
output
OOOoOooOooooOoo
前两天做那个牛客网的oOOoo的题做的要疯了,今天一看到这个题,很快就有思路了,然后打,然后不能运行。。。最后打了个裴波纳契的表,最后遍历了一下,然后过了。。。但是心情还是很不好,不管怎样,走下去吧。。。
代码:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int b[1005];
int main()
{
b[1]=1;
b[2]=1;
b[3]=1;
b[5]=1;
b[8]=1;
b[13]=1;
b[21]=1;
b[34]=1;
b[55]=1;
b[89]=1;
b[144]=1;
b[233]=1;
b[377]=1;
b[610]=1;
b[987]=1;
int n;
while(~scanf("%d",&n))
{
for(int i=1; i<=n; i++)
{
if(b[i]==1)
{
printf("O");
}
else if(b[i]==0)
{
printf("o");
}
}
printf("\n");
}
}