Karl likes Codeforces and subsequences. He wants to find a string of lowercase English letters that contains at least k subsequences codeforces. Out of all possible strings, Karl wants to find a shortest one.
Formally, a codeforces subsequence of a string s is a subset of ten characters of s that read codeforces from left to right. For example, codeforces contains codeforces a single time, while codeforcesisawesome contains codeforces four times: codeforcesisawesome, codeforcesisawesome, codeforcesisawesome, codeforcesisawesome.
Help Karl find any shortest string that contains at least k codeforces subsequences.
Input
The only line contains a single integer k (1≤k≤1016).
Output
Print a shortest string of lowercase English letters that contains at least k codeforces subsequences. If there are several such strings, print any of them.
Examples
input
1
output
codeforces
input
3
output
codeforcesss
题意
在字符串 s s s 的子串中( 子串可以不连续 ),包含至少 k k k 个 c o d e f o r c e s codeforces codeforces 的最短字符串 s s s 。
思路
因为子串可以不连续,所以 s s s 中 c o d e f o r c e s codeforces codeforces 的数量 = 每个字符数量的乘积。
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> PII;
typedef long long ll;
const int N = 20;
int cnt[N];
int main()
{
string st = "codeforces";
ll n; cin >> n;
for (int i = 0; i < 10; i++) cnt[i] = 1;
int j = 0;
while (true)
{
ll res = 1;
for (int i = 0; i < 10; i++) res *= cnt[i];
if (res >= n) break;
cnt[(j++) % 10]++;
}
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < cnt[i]; j++) cout << st[i];
}
cout << endl;
return 0;
}