微信小程序制作精灵,seo都用在哪些网站,网站空间是啥,食品包装设计说明猪猪 Hanke 特别喜欢吃烤鸡#xff08;本是同畜牲#xff0c;相煎何太急#xff01;#xff09;Hanke 吃鸡很特别#xff0c;为什么特别呢#xff1f;因为他有 1010 种配料#xff08;芥末、孜然等#xff09;#xff0c;每种配料可以放 11 到 33 克#xff0c;任意烤… 猪猪 Hanke 特别喜欢吃烤鸡本是同畜牲相煎何太急Hanke 吃鸡很特别为什么特别呢因为他有 1010 种配料芥末、孜然等每种配料可以放 11 到 33 克任意烤鸡的美味程度为所有配料质量之和。 现在 Hanke 想要知道如果给你一个美味程度 n 请输出这 1010 种配料的所有搭配方案。 输入格式 一个正整数 n表示美味程度。 输出格式 第一行方案总数。 第二行至结束1010 个数表示每种配料所放的质量按字典序排列。 如果没有符合要求的方法就只要在第一行输出一个 00。 #include iostream
#includestring.h
using namespace std;//4进制的数
char ct[] 1111111111;
void next() {ct[9] 1;for (int i 9; i 0; i--) { if (ct[i] 4) {ct[i] 1;ct[i - 1] 1;}}
}
int cnt() {int n 0;for (int i 9; i 0; i--)n ct[i] - 0;return n;
} int main() {int t;int res 0;scanf(%d,t);while (1) {if (cnt() t) {res 1; }if (strcmp(ct,3333333333)0)break;next();}printf(%d\n,res);res 0;strcpy(ct,1111111111);while (1) {if (cnt() t) {cout ct endl;}if (strcmp(ct, 3333333333) 0)break;next();}return 0;
}