Problem Description
=== Op tech briefing, 2002/11/02 06:42 CST ===
"The item is locked in a Klein safe behind a painting in the second-floor library. Klein safes are extremely rare; most of them, along with Klein and his factory, were destroyed in World War II. Fortunately old Brumbaugh from research knew Klein's secrets and wrote them down before he died. A Klein safe has two distinguishing features: a combination lock that uses letters instead of numbers, and an engraved quotation on the door. A Klein quotation always contains between five and twelve distinct uppercase letters, usually at the beginning of sentences, and mentions one or more numbers. Five of the uppercase letters form the combination that opens the safe. By combining the digits from all the numbers in the appropriate way you get a numeric target. (The details of constructing the target number are classified.) To find the combination you must select five letters v, w, x, y, and z that satisfy the following equation, where each letter is replaced by its ordinal position in the alphabet (A=1, B=2, ..., Z=26). The combination is then vwxyz. If there is more than one solution then the combination is the one that is lexicographically greatest, i.e., the one that would appear last in a dictionary."

v - w^2 + x^3 - y^4 + z^5 = target

"For example, given target 1 and letter set ABCDEFGHIJKL, one possible solution is FIECB, since 6 - 9^2 + 5^3 - 3^4 + 2^5 = 1. There are actually several solutions in this case, and the combination turns out to be LKEBA. Klein thought it was safe to encode the combination within the engraving, because it could take months of effort to try all the possibilities even if you knew the secret. But of course computers didn't exist then."

=== Op tech directive, computer division, 2002/11/02 12:30 CST ===

"Develop a program to find Klein combinations in preparation for field deployment. Use standard test methodology as per departmental regulations. Input consists of one or more lines containing a positive integer target less than twelve million, a space, then at least five and at most twelve distinct uppercase letters. The last line will contain a target of zero and the letters END; this signals the end of the input. For each line output the Klein combination, break ties with lexicographic order, or 'no solution' if there is no correct combination. Use the exact format shown below."

Sample Input
1 ABCDEFGHIJKL
11700519 ZAYEXIWOVU
3072997 SOUGHT
1234567 THEQUICKFROG
0 END

Sample Output
LKEBA
YOXUZ
GHOST
no solution

Problem Description Lulu has a sweet tooth. Her favorite food is ring donut. Everyday she buys a ring donut from the same bakery. A ring donut is consists of n parts. Every part has its own sugariness that can be expressed by a letter from a to z (from low to high), and a ring donut can be expressed by a string whose i-th character represents the sugariness of the i−th part in clockwise order. Note that z is the sweetest, and two parts are equally sweet if they have the same sugariness. Once Lulu eats a part of the donut, she must continue to eat its uneaten adjacent part until all parts are eaten. Therefore, she has to eat either clockwise or counter-clockwise after her first bite, and there are 2n ways to eat the ring donut of n parts. For example, Lulu has 6 ways to eat a ring donut abc: abc,bca,cab,acb,bac,cba. Lulu likes eating the sweetest part first, so she actually prefer the way of the greatest lexicographic order. If there are two or more lexicographic maxima, then she will prefer the way whose starting part has the minimum index in clockwise order. If two ways start at the same part, then she will prefer eating the donut in clockwise order. Please compute the way to eat the donut she likes most. Input First line contain one integer T,T≤20, which means the number of test case. For each test case, the first line contains one integer n,n≤20000, which represents how many parts the ring donut has. The next line contains a string consisted of n lowercase alphabets representing the ring donut. Output You should print one line for each test case, consisted of two integers, which represents the starting point (from 1 to n) and the direction (0 for clockwise and 1 for counterclockwise). Sample Input 2 4 abab 4 aaab Sample Output 2 0 4 0

Problem Description Accidentally, Cupid, god of desire has hurt himself with his own dart and fallen in love with Psyche. This has drawn the fury of his mother, Venus. The goddess then throws before Psyche a great mass of mixed crops. There are n heaps of crops in total, numbered from 1 to n. Psyche needs to arrange them in a certain order, assume crops on the i-th position is Ai. She is given some information about the final order of the crops: 1. the minimum value of A1,A2,...,Ai is Bi. 2. the maximum value of A1,A2,...,Ai is Ci. She wants to know the number of valid permutations. As this number can be large, output it modulo 998244353. Note that if there is no valid permutation, the answer is 0. Input The first line of input contains an integer T (1≤T≤15), which denotes the number of testcases. For each test case, the first line of input contains single integer n (1≤n≤105). The second line contains n integers, the i-th integer denotes Bi (1≤Bi≤n). The third line contains n integers, the i-th integer denotes Ci (1≤Ci≤n). Output For each testcase, print the number of valid permutations modulo 998244353. Sample Input 2 3 2 1 1 2 2 3 5 5 4 3 2 1 1 2 3 4 5 Sample Output 1 0
C语言，程序结构 程序不能正常运行
#include <stdio.h> #include <stdlib.h> #define num 100 #define OK 1 typedef int Status; typedef char DataType; typedef struct node { DataType data; struct node *lchild,*rchild; }BinTNode,*BinTree; int found; BinTNode *p; /*****************建立二叉树*****************/ Status CreateBiTree(BinTree &bt) //1.按照先序遍历次序递建立二叉树 { char ch; printf("ch="); scanf("%c",&ch); getchar(); if (ch==' ') bt=NULL; //程序中直接输入空格停止 else { bt=(BinTNode *)malloc(sizeof(BinTNode)); bt->data=ch; //生成根结点 printf("请输入左子树：\n"); CreateBiTree(bt->lchild); printf("请输入右子树：\n"); //构造左子树 CreateBiTree(bt->rchild); //构造右子树 } return OK; } /*****************中序遍历二叉树*****************/ Status Inorder(BinTree bt) //中序遍历算法 { BinTNode *stack[num]; //定义栈数组 int top=0; //初始化栈 stack[top]=bt; do { while(NULL!=stack[top]) //扫描根结点及其所有的左结点并入栈 { top=top+1; stack[top]=stack[top-1]->lchild; } top=top-1; //退栈 if(top>=0) //判断栈是否为空 { printf("%c",stack[top]->data); //访问结点 stack[top]=stack[top]->rchild; //扫描右子树 } }while(top>=0); return OK; } /*Status Inorder(BinTree bt) //先序遍历算法 { BinTNode *stack[num]; //定义栈数组 int top=0; //初始化栈 stack[top]=bt; do { while(NULL!=stack[top]) //扫描根结点及其所有的左结点并入栈 { top=top+1; printf("%c",stack[top]->data); stack[top]=stack[top-1]->lchild; } top=top-1; //退栈 if(top>=0) //判断栈是否为空 { printf("%c",stack[top]->data); //访问结点 stack[top]=stack[top]->rchild; //扫描右子树 } }while(top>=0); return OK; } */ /*****************求指定节点路径*****************/ BinTree NodePath(BinTree bt, BinTNode *ch) //3.求二叉树指定结点的路径 { typedef enum{FALSE,TRUE}boolean; BinTNode *stack[num];//定义栈 int i,top,tag[num]; boolean find;//定义布尔类型变量 BinTNode *s; find=FALSE;//初始化 top=0; s=bt; do {while(s!=NULL) { top++; stack[top]=s; tag[top]=0; s=s->lchild; } if(top>0) {s=stack[top]; if(tag[top]==1) { if(s==ch) {for(i=1;i<=top;i++) printf("->%c",stack[i]->data); find=TRUE; }else top--; s=stack[top]; } if(top>0&&!find) { if(tag[top]!=1) { s=s->rchild;//扫描右子树 tag[top]=1; } else s=NULL; } } }while(!find&&top!=0); return s; } void FindBT(BinTree bt,DataType x) { if((bt!=NULL)&&!found) { if(bt->data==x) { p=bt; found=1; } else { FindBT(bt->lchild,x); FindBT(bt->rchild,x); } } } BinTNode *Findx(BinTree bt,DataType x) { int found=0; BinTree p=NULL; FindBT(bt,x); return(p); } /*****************求二叉树的深度*****************/ int Depth(BinTree bt) //4.求二叉树的深度 { int h,lh,rh; if (bt==NULL) h=0; else { lh=Depth(bt->lchild); rh=Depth(bt->rchild); if (lh>=rh) h=lh+1; else h=rh+1; } return h; } /*****************求叶子节点的个数*****************/ int Leaf(BinTree bt) //5.求二叉树的叶子结点个数 { if (bt==NULL) return 0; else if (bt->lchild==NULL&&bt->rchild==NULL) return OK; else return Leaf(bt->lchild)+Leaf(bt->rchild); } /*****************调换左右子树*****************/ BinTNode *huhuan(BinTNode *p)//6.将p指针指向的二叉树的左右子树进行互换 {BinTNode *stack[num];//指针类型的堆栈 int k=0; stack[k]=NULL; if(p!=NULL)//交换p结点的左右孩子 { k++; stack[k]=p->lchild; p->lchild=p->rchild; p->rchild=stack[k]; p->lchild=huhuan(p->lchild); p->rchild=huhuan(p->rchild); } return (p); } /*****************主函数*****************/ void main() { BinTree bt; char ch1; int xz=1,sd=0,yz=0; while(xz) { printf(" 建立二叉树并求指定结点路径 \n"); printf("============================\n"); printf(" 1.建立二叉树的存储结构 \n"); printf(" 2.求解二叉树的中序遍历 \n"); printf(" 3.求二叉树指定结点的路径 \n"); printf(" 4.求二叉树的深度 \n"); printf(" 5.求二叉树的叶子结点个数 \n"); printf(" 6.将二叉树左右子树交换 \n"); printf(" 0.退出系统 \n"); printf("============================\n"); printf(" 请选择：(0-6) \n"); scanf("%d",&xz); getchar(); switch(xz) { case 1: printf("请输入根节点：\n"); CreateBiTree(bt); printf( "二叉树的链式存储结构建立完成!\n"); break; case 2:printf("该二叉树的中序遍历序列是:\n"); Inorder(bt); printf( "\n"); break; case 3:printf( "请输入要求路径的结点值：\n" ); ch1=getchar(); p=NULL; found=0; Findx(bt,ch1); if(p!=NULL) NodePath(bt,p); else printf( "没有要求的节点！ \n" ); printf( "\n" ); break; case 4:sd=Depth(bt); printf( "该二叉树的深度为：%d \n ",sd ); printf("\n"); break; case 5:yz=Leaf(bt); printf( "该二叉树的叶子节点数为：\n%d \n",yz ); printf( "\n" ); break; case 6: bt=huhuan(bt); printf( "该二叉树的左右结点已交换成功，其中序遍历序列是:\n" ); Inorder(bt); printf( "\n" ); break; } } }

《MySQL 性能优化》之理解 MySQL 体系结构

【资源】一个C/C++开发工程师的学习路线（已经无路可退，唯有逆风飞翔）【内附资源页】

20道你必须要背会的微服务面试题，面试一定会被问到

【CSDN编者按】1月2日，阿里巴巴发布《达摩院2020十大科技趋势》，十大科技趋势分别是：人工智能从感知智能向认知智能演进；计算存储一体化突破AI算力瓶颈；工业互联网的超融合；机器间大规模协作成为可能；模块化降低芯片设计门槛；规模化生产级区块链应用将走入大众；量子计算进入攻坚期；新材料推动半导体器件革新；保护数据隐私的AI技术将加速落地；云成为IT技术创新的中心 。 新的画卷，正在徐徐展开。...

Python+OpenCV实时图像处理

2020年一线城市程序员工资大调查

python爬取百部电影数据，我分析出了一个残酷的真相
2019年就这么匆匆过去了，就在前几天国家电影局发布了2019年中国电影市场数据，数据显示去年总票房为642.66亿元，同比增长5.4%；国产电影总票房411.75亿元，同比增长8.65%，市场占比 64.07%；城市院线观影人次17.27亿，同比增长0.64%。 看上去似乎是一片大好对不对？不过作为一名严谨求实的数据分析师，我从官方数据中看出了一点端倪：国产票房增幅都已经高达8.65%了，为什...

Windows可谓是大多数人的生产力工具，集娱乐办公于一体，虽然在程序员这个群体中都说苹果是信仰，但是大部分不都是从Windows过来的，而且现在依然有很多的程序员用Windows。 所以，今天我就把我私藏的Windows必装的软件分享给大家，如果有一个你没有用过甚至没有听过，那你就赚了????，这可都是提升你幸福感的高效率生产力工具哦！ 走起！???? NO、1 ScreenToGif 屏幕，摄像头和白板...

2020 年，大火的 Python 和 JavaScript 是否会被取而代之？
Python 和 JavaScript 是目前最火的两大编程语言，但是2020 年，什么编程语言将会取而代之呢？ 作者 |Richard Kenneth Eng 译者 |明明如月，责编 | 郭芮 出品 | CSDN（ID：CSDNnews） 以下为译文： Python 和 JavaScript 是目前最火的两大编程语言。然而，他们不可能永远屹立不倒。最终，必将像其他编程语言一...

AI 没让人类失业，搞 AI 的人先失业了

2020年，冯唐49岁：我给20、30岁IT职场年轻人的建议

B站是个宝，谁用谁知道???? 作为一名大学生，你必须掌握的一项能力就是自学能力，很多看起来很牛X的人，你可以了解下，人家私底下一定是花大量的时间自学的，你可能会说，我也想学习啊，可是嘞，该学习啥嘞，不怕告诉你，互联网时代，最不缺的就是学习资源，最宝贵的是啥？ 你可能会说是时间，不，不是时间，而是你的注意力，懂了吧！ 那么，你说学习资源多，我咋不知道，那今天我就告诉你一个你必须知道的学习的地方，人称...

loonggg读完需要2分钟速读仅需 1 分钟大家我，我是你们的校长。前几天，搜狐的董事局主席兼 CEO 张朝阳和搜狐都上热搜了。原因很简单，就是搜狐出了“考勤新规”。一封搜狐对员工发布...

【蘑菇街技术部年会】程序员与女神共舞，鼻血再次没止住。（文末内推）

Java校招入职华为，半年后我跑路了

​两年前不知如何编写代码的我，现在是一名人工智能工程师

loonggg读完需要5分钟速读仅需 2 分钟大家好，我是你们的校长。我知道大家在家里都憋坏了，大家可能相对于封闭在家里“坐月子”，更希望能够早日上班。今天我带着大家换个思路来聊一个问题...

&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt; &lt;meta http-equiv="X...
Spring框架|JdbcTemplate介绍