(200624) 코드포스

Codeforces materials usage license (v. 0.1) 에 따라 codeforces.com 의 문제임을 알립니다.

Original problem link: Problem - 1368B - Codeforces


Example

Input

1

Output

codeforces

Input

3

Output

codeforcesss

1368B
#include <algorithm>
#include <cmath>
#include <functional> 
#include <iostream>
#include <queue>
#include <string>
#include <vector>

namespace predefined {

#ifdef CODEFORCES_DEBUG
  constexpr bool kIsDebug = true;
#else
  constexpr bool kIsDebug = false;
#endif

enum class LogType {
  INFO,
  DEBUG
};

template <LogType type, bool... Bools>
struct Log;

template <>
struct Log<LogType::INFO> {
  Log() {}
  ~Log() { std::cout << '\n'; }

  template <typename T>
  Log& operator<< (const T &t) {
    std::cout << t;
    return *this;
  }
};

template <>
struct Log<LogType::DEBUG, true>{
  Log() {}
  ~Log() { std::cout << '\n'; }

  void Open() {
    freopen("input.txt", "r", stdin);
  }

  template <typename T>
  Log& operator<< (const T &t) {
    std::cout << t;
    return *this;
  }
};

template <>
struct Log<LogType::DEBUG, false> {
  Log() {}
  ~Log() {}

  void Open() {}

  template <typename T>
  Log& operator<< (const T &t) { return *this; }
};

template<typename T>
struct BoolMap {
  explicit BoolMap(const T &_true_value, const T &_false_value) 
    : true_value(_true_value),
      false_value(_false_value) {}

  const T true_value;
  const T false_value;

  const T inline GetValue(const bool bool_key) const {
    return bool_key ? true_value : false_value;  
  };
};

}  // predefined;

#define LOG_INFO predefined::Log<predefined::LogType::INFO>()
#define LOG_DEBUG predefined::Log<predefined::LogType::DEBUG, predefined::kIsDebug>()
#define LOG(LEVEL) LOG_##LEVEL

#define INIT_ANSWER(true_string, false_string) \
  const predefined::BoolMap<std::string> bool_string_map(true_string, false_string)
#define GET_ANSWER(bool_key) \
  bool_string_map.GetValue(bool_key)

// macros

namespace {
using namespace std;

constexpr char kCodeforces[] = "codeforces";
}  // unnamed namespace;


int main(int argc, char** argv) {
  ios::sync_with_stdio(false); 
  cin.tie(NULL);
  LOG(DEBUG).Open();

  queue<uint64_t> character_counts;

  for (char c : kCodeforces) {
    if(c == '\0') continue;
    character_counts.push(1);
  }

  uint64_t k;
  cin >> k;

  uint64_t number = 1;
  while (number < k) {
    auto now = character_counts.front();
    character_counts.pop();
    number /= now++;
    number *= now;
    character_counts.push(now);
  }

  string ans;

  for (char c : kCodeforces) {
    if(c == '\0') continue;
    auto now = character_counts.front();
    character_counts.pop();
    while(now--) ans += c;
  }

  LOG(INFO) << ans;

  return 0;
}