熬夜打CF结果今天老师讲课啥都没听233
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
$f_1=1$,
$f_2 =1$,
$f_n = f_(n - 2) + f_(n - 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
大意:
输出一个由‘O’和‘o’组成的长度为$n$的子串,如果$i$为斐波那契数,则第$i$个字符为‘O’,其他输出‘o’
题解:
看到题目一阵激动:“签到题赶紧虐”
又发现限制$(1 ≤ n ≤1000)$
于是就不想推公式YY出了下面的代码:
1 #include <map> 2 #include <list> 3 #include <cmath> 4 #include <cstdio> 5 #include <cstring> 6 #include <iostream> 7 #include <algorithm>//头文件大根堆 8 using namespace std; 9 int n; 10 int main() 11 { 12 cin>>n; 13 for (int i=1;i<=n;i++) 14 { 15 if (i==1||i==2||i==3||i==5||i==8||i==13||i==21||i==34||i==55||i==89||i==144||i==233||i==377||i==610||i==987) 16 cout<<"O"; 17 else 18 cout<<"o"; 19 } 20 return 0; 21 }
其实。。。手打感觉确实很好
B题题面: