H - Eleven
分析:此处可通过列举,看大佬的说法只开30就够用,故以下可作优化。
解法:
#include<iostream>
using namespace std;
long long a[1002];
void feb(void) {
a[0] = 1;
a[1] = 1;
for (int i = 2; i < 1002; i++)
{
a[i] = a[i - 1] + a[i - 2];
}
}
int main() {
feb();
int n = 0, t = 1;
while (~scanf_s("%d", &n)) {
t = 1;
for (int i = 1; i <= n; i++) {
if (i == a[t]) {
t++;
cout << "O";
}
else
cout << "o";
}
cout << endl;
}
}