Codeforces Round #459 (Div. 2)-A. Eleven
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
解题心得:
- 就是考的一个斐波那契的问题,很简单。
#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的更多相关文章
- 【Codeforces Round #459 (Div. 2) A】Eleven
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 这个数列增长很快的. 直接暴力模拟看看是不是它的一项就好了 [代码] #include <bits/stdc++.h> ...
- Codeforces Round #459 (Div. 2)
A. Eleven time limit per test 1 second memory limit per test 256 megabytes input standard input outp ...
- 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 ...
- Codeforces Round #459 (Div. 2):D. MADMAX(记忆化搜索+博弈论)
D. MADMAX time limit per test1 second memory limit per test256 megabytes Problem Description As we a ...
- Codeforces Round #459 (Div. 2):B. Radio Station
B. Radio Station time limit per test2 seconds memory limit per test256 megabytes Problem Dsecription ...
- Codeforces Round #459 Div. 1
C:显然可以设f[i][S]为当前考虑到第i位,[i,i+k)的状态为S的最小能量消耗,这样直接dp是O(nC(k,x))的.考虑矩阵快速幂,构造min+转移矩阵即可,每次转移到下一个特殊点然后暴力处 ...
- Codeforces Round #459 (Div. 2):D. MADMAX(记忆化搜索+博弈论)
题意 在一个有向无环图上,两个人分别从一个点出发,两人轮流从当前点沿着某条边移动,要求经过的边权不小于上一轮对方经过的边权(ASCII码),如果一方不能移动,则判负.两人都采取最优策略,求两人分别从每 ...
- Codeforces Round #459 (Div. 2)The Monster[匹配问题]
题意 给一个序列,包含(,),?,?可以被当做(或者),问你这个序列有多少合法的子序列. 分析 n^2枚举每一个子序列,暂时将每个?都当做右括号,在枚举右端点的时候同时记录两个信息:当前左括号多余多少 ...
- 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 ...
随机推荐
- &&运算符和||运算符的优先级问题 专题
public class SyntaxTest { @Test public void test() { System.out.println(true || true && fals ...
- spring运用的设计模式
1.代理模式(典型的aop) 2.工厂模式(beanFactory) 3.观察者模式(ApplicationContextEvent && ApplicationContextList ...
- websocket的加密和解密
补充个小知识点:按位与运算 按位与运算是同位都为1才为1,有一个不为1就是0 websocket_hand import socket, base64, hashlib import websocke ...
- 学习笔记:SVG和Canvas
SVG SVG 与 Flash 类似,都是用于二维矢量图形,二者的区别在于,SVG 是一个 W3C 标准,基于 XML,是开放的.因为是 W3C 标准,SVG 与其他的 W3C 标准,比如 CSS.D ...
- input和textarea修改placeholder颜色和字号
方式1因为每个浏览器的CSS选择器都有所差异,所以需要针对每个浏览器做单独的设定(可以在冒号前面写input和textarea).::-webkit-input-placeholder { /* We ...
- PL/SQL中模拟EBS上下文
有时,我们需要查询的表或视图,是具有OU屏蔽的,这时我们就需要模拟EBS中的上下文来实现查询数据. BEGIN fnd_global.apps_initialize(user_id =>1,re ...
- C# linq根据自定义筛选条件和所对应的数值进行筛选
在软件应用中有时候会出现这样的界面:上面是利用多选框和下拉框组合的筛选条件.下面表格展示筛选后的数据.如下图 上面是筛选条件,表格是根据筛选条件筛选的结果. 如果表格不支持筛选功能.可以利用Linq对 ...
- springMvc-对servletApi的支持以及把后台对象以json方式传到前台
1.对servletApi的支持:request.response以及session.cookie的支持 2.把后台代码以json格式向前台输出: 代码: package com.java.contr ...
- Nginx+Keepalived双主轮询负载均衡
双主模式使用两个VIP,前段有2台服务器,互为主从,两台服务器同时工作,不存在资源浪费情况.同时在前端的DNS服务器对网站做多条A记录,实现了Nginx的负载均衡,当一台服务器故障时候,资源会转移到另 ...
- 访问mongo数据库报错
It looks like you are trying to access MongoDB over HTTP on the native driver port. 出错原因: 1.没有安装mong ...