A. Eleven

time limit per test1 second

memory limit per test256 megabytes

Problem Description

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


解题心得:

  1. 就是考的一个斐波那契的问题,很简单。

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5+100;
int num[maxn];
bool vis[maxn];
int main()
{
memset(num,0,sizeof(num));
memset(vis,0,sizeof(vis));
num[0] = 1,num[1] = 1;
int n;
scanf("%d",&n);
for(int i=2;;i++)
{
num[i] = num[i-1] + num[i-2];
vis[num[i]] = true;
if(num[i] > 3000)
break;
}
vis[1] = true;
for(int i=1;i<=n;i++)
if(vis[i])
printf("O");
else
printf("o");
return 0;
}

Codeforces Round #459 (Div. 2)-A. Eleven的更多相关文章

  1. 【Codeforces Round #459 (Div. 2) A】Eleven

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 这个数列增长很快的. 直接暴力模拟看看是不是它的一项就好了 [代码] #include <bits/stdc++.h> ...

  2. Codeforces Round #459 (Div. 2)

    A. Eleven time limit per test 1 second memory limit per test 256 megabytes input standard input outp ...

  3. Codeforces Round #459 (Div. 2) D. MADMAX DFS+博弈

    D. MADMAX time limit per test 1 second memory limit per test 256 megabytes input standard input outp ...

  4. Codeforces Round #459 (Div. 2):D. MADMAX(记忆化搜索+博弈论)

    D. MADMAX time limit per test1 second memory limit per test256 megabytes Problem Description As we a ...

  5. Codeforces Round #459 (Div. 2):B. Radio Station

    B. Radio Station time limit per test2 seconds memory limit per test256 megabytes Problem Dsecription ...

  6. Codeforces Round #459 Div. 1

    C:显然可以设f[i][S]为当前考虑到第i位,[i,i+k)的状态为S的最小能量消耗,这样直接dp是O(nC(k,x))的.考虑矩阵快速幂,构造min+转移矩阵即可,每次转移到下一个特殊点然后暴力处 ...

  7. Codeforces Round #459 (Div. 2):D. MADMAX(记忆化搜索+博弈论)

    题意 在一个有向无环图上,两个人分别从一个点出发,两人轮流从当前点沿着某条边移动,要求经过的边权不小于上一轮对方经过的边权(ASCII码),如果一方不能移动,则判负.两人都采取最优策略,求两人分别从每 ...

  8. Codeforces Round #459 (Div. 2)The Monster[匹配问题]

    题意 给一个序列,包含(,),?,?可以被当做(或者),问你这个序列有多少合法的子序列. 分析 n^2枚举每一个子序列,暂时将每个?都当做右括号,在枚举右端点的时候同时记录两个信息:当前左括号多余多少 ...

  9. Codeforces Round #459 (Div. 2)C. The Monster

    C. The Monster time limit per test 1 second memory limit per test 256 megabytes input standard input ...

随机推荐

  1. 熟悉servlet的页面跳转

    jspweb里面用到的servlet跳转页面的方法 使用的jar包只有 commons-lang3-3.5.jar 运行时,tomcat会先根据web.xml里面的信息,查找servlet <? ...

  2. JQury各种ajax函数

    $.get(url,[data],[callback],[type]) 说明:以get方式发送请求,url为请求地址,data为请求数据的列表,callback为请求成功后的回调函数,该函数接受两个参 ...

  3. UITableViewCellStyle 四种样式

    四种样式如下:

  4. tomcat的备份脚本

    reference:Crontab的20个例子  先科普一下date的使用方法,在sh脚本中经常会使用得到 date -d<字符串>:显示字符串所指的日期与时间.字符串前后必须加上双引号: ...

  5. hibernate课程 初探单表映射2-2 hibernate常用配置

    1 hibernate.cfg.xml常用配置: show_sql 控制台打印sql format_sql 控制台将sql排版 hbm2ddl.auto: create 删除表结构,重新建表并插值 u ...

  6. 谈谈我对MVC的View层实现的理解

    MVC框架可以把应用清晰明了地分为三个部分:Model层–数据层,View层–视图层,Controller–逻辑层,Model层负责整合数据,View层负责页面渲染,Controller层负责实现业务 ...

  7. 浅谈.htaccess文件--避免滥用.htaccess文件

    .htaccess文件提供了一种目录级别的修改配置的方式. NOTE: 如果你拥有修改apache配置文件的权限,那么完全没有必要使用.htaccess文件.使用.htaccess文件会拖慢apach ...

  8. iOS 基础笔试题

    参考:https://www.jianshu.com/p/1d3496bc5bda 1.#import 跟#include.@class有什么区别?#import<> 跟 #import& ...

  9. 零基础逆向工程25_C++_02_类的成员权限_虚函数_模板

    1 类的成员权限 1.1 小结: 1.对外提供的函数或者变量,发布成public的 但不能随意改动. 2.可能会变动的函数或者变量,定义成private的 这样编译器会在使用的时候做检测. 3.只有结 ...

  10. javascript面向对象继承和原型

    一.理解什么是对象:任何东西都可以是对象,对象就是一组无序属性的集合 对象具有属性和方法1.1 属性的类型属性内部又定义了两种属性:数据属性和访问器属性 (1)数据属性:有4个描述的行为 Config ...