918A - Eleven - CodeForces Solution


brute force implementation *800

Please click on ads to support us..

Python Code:

a=int(input())
q=1
w=1
h=''
for s in range(1,a+1):
    if w==s:
        h+='O'
        q,w=w,q+w
    else:
        h+='o'
print(h)

C++ Code:

/* بِسْمِ اللَّـهِ الرَّحْمَـٰنِ الرَّحِيمِ */
#include<bits/stdc++.h>

#define accelerate cin.tie(0); cin.sync_with_stdio(0);
typedef long long ll;
using namespace std;


bool sortPairBySecondElement(const pair<int, int> &a, const pair<int, int> &b);

vector<ll> factorization(ll n);

vector<bool> segmentedSieve(long long L, long long R);

bool isPrim(ll number);

vector<bool> sieve(ll sieveNumber);

long long binaryExponentiation(long long number, long long power, int mod);


bool fre[2000];
int coun;
int maxi[5000];

int fib(int number) {
    if (number <= 1)
        return 1;
    if (maxi[number])
        return maxi[number];

    maxi[number] = fib(number - 1) + fib(number - 2);
    fre[maxi[number]] = true;
    return maxi[number];
}


int main() {
    accelerate
    fib(17);
    int input;
    cin >> input;
    for (int i = 1; i <= input; ++i) {
        if (fre[i] || i == 1)cout << 'O';
        else cout << 'o';
    }
}

  				 			  						 		  	  	 		


Comments

Submit
0 Comments
More Questions

1455B - Jumps
1225C - p-binary
1525D - Armchairs
1257A - Two Rival Students
1415A - Prison Break
1271A - Suits
259B - Little Elephant and Magic Square
1389A - LCM Problem
778A - String Game
1382A - Common Subsequence
1512D - Corrupted Array
667B - Coat of Anticubism
284B - Cows and Poker Game
1666D - Deletive Editing
1433D - Districts Connection
2B - The least round way
1324A - Yet Another Tetris Problem
246B - Increase and Decrease
22E - Scheme
1566A - Median Maximization
1278A - Shuffle Hashing
1666F - Fancy Stack
1354A - Alarm Clock
1543B - Customising the Track
1337A - Ichihime and Triangle
1366A - Shovels and Swords
919A - Supermarket
630C - Lucky Numbers
1208B - Uniqueness
1384A - Common Prefixes