Codeforces Global Round 8 B - Codeforces Subsequences 构造
Posted qingyuyyyyy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Codeforces Global Round 8 B - Codeforces Subsequences 构造相关的知识,希望对你有一定的参考价值。
#include<map> #include<queue> #include<time.h> #include<limits.h> #include<cmath> #include<ostream> #include<iterator> #include<set> #include<stack> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; #define rep_1(i,m,n) for(int i=m;i<=n;i++) #define mem(st) memset(st,0,sizeof st) int read() { int res=0,ch,flag=0; if((ch=getchar())==‘-‘) //判断正负 flag=1; else if(ch>=‘0‘&&ch<=‘9‘) //得到完整的数 res=ch-‘0‘; while((ch=getchar())>=‘0‘&&ch<=‘9‘) res=res*10+ch-‘0‘; return flag?-res:res; } typedef long long ll; typedef pair<int,int> pii; typedef unsigned long long ull; typedef pair<double,double> pdd; const int inf = 0x3f3f3f3f; ll k,arr[11] = {0},sum = 0,m = 1; char str[12] = {" codeforces"}; signed main() { cin >> k; vector<char> v[11]; while(sum < k) { sum = 1; v[m].push_back(str[m]);//存储每一个字符 arr[m]++; m == 10 ? m = 1 : m++; for(int i = 1; i <= 10; i++) sum *= arr[i]; //算个数 } for(int i = 1; i <= 10; i++) for(int j = 0; j < v[i].size(); j++) cout << v[i][j]; return 0; }
以上是关于Codeforces Global Round 8 B - Codeforces Subsequences 构造的主要内容,如果未能解决你的问题,请参考以下文章
Codeforces Global Round 8 A. C+=(贪心)
Codeforces Global Round 8 E. Ski Accidents
Codeforces Global Round 8 E - Ski Accidents 拓扑
Codeforces Global Round 8 D. AND, OR and square sum(位运算)
Codeforces Global Round 8 D - AND, OR and square sum 尽量往大的数字上移动