今天去NOKIA机试,纯粹打酱油,没什么准备,题目貌似不难,但时间和空间效率都要求很高,现场调试成功还是要相当的水准的。
以后要好好练练北大ACM上的题目了。以下题目自然输入项范围都很大,时间和空间效率要求最优。题目细节记不太清了,大致翻译而已。全部只能用C语言完成。
1. 输入: char *S
<span style="white-space: pre;"> </span>字符串S是a-z的任意字符组成的乱序字符串,没有任何规律。
要求判断经过顺序调整,字符串S可否变成回文数。
<span style="white-space: pre;"></span>输出:
<span style="white-space: pre;"></span>可变为回文数输出为1,不能变成输出为0.
<span style="white-space: pre;"></span>例如:
<span style="white-space: pre;"></span>wjockwajiaock可变为回文数
<span style="white-space: pre;"></span>wojackikcajow ,返回1.
<span style="white-space: pre;"></span>abcbba,不能变为回文数,返回0.
<span style="white-space: pre;"></span>
2. 判断十进制整数N,在m(2<=m<=36)进制下,经进制变换后要求用<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px; line-height: 20px;">big endian顺序输出结果。</span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"> 例如:</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"> 当m=16,N=31,输出应为1f。</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"> 当m=26,N= 70 ,输出应为2i。</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"> 当m=21,N=62,输出应为2k。</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"> </span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;">3.已知数组A[N],当然数组很大,数组元素值为整数,有正有负,求使连续下标区间内所有元素和最大的值。(附加项:记录区间下标)</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;">例如:A[0]=-1,A[1]=8,A[2]=3,A[3]=-6</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(0,0)=-1</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(0,1)=7</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(0,2)=10</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(0,3)=4</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(1,1)=8</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(1,2)=11</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(1,3)=5</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(2,3)=-3</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(3,3)=-6</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;">输出值为A(1,2),11。</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;">4.求一个数组A[N]内,输出所有不满足当下标i<j时,而数组元素值A[i]>A[j]的所有元素值和下标对。(貌似是这个意思,有少许改动)</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>例如:</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A[0]=5,A[1]=3,A[2]=4,A[3]=2,A[4]=3</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>输出</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A[1]和A[2],A[1]和A[4],A[3]和A[4]。</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><br></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span></span></span>
以后要好好练练北大ACM上的题目了。以下题目自然输入项范围都很大,时间和空间效率要求最优。题目细节记不太清了,大致翻译而已。全部只能用C语言完成。
1. 输入: char *S
<span style="white-space: pre;"> </span>字符串S是a-z的任意字符组成的乱序字符串,没有任何规律。
要求判断经过顺序调整,字符串S可否变成回文数。
<span style="white-space: pre;"></span>输出:
<span style="white-space: pre;"></span>可变为回文数输出为1,不能变成输出为0.
<span style="white-space: pre;"></span>例如:
<span style="white-space: pre;"></span>wjockwajiaock可变为回文数
<span style="white-space: pre;"></span>wojackikcajow ,返回1.
<span style="white-space: pre;"></span>abcbba,不能变为回文数,返回0.
<span style="white-space: pre;"></span>
2. 判断十进制整数N,在m(2<=m<=36)进制下,经进制变换后要求用<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px; line-height: 20px;">big endian顺序输出结果。</span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"> 例如:</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"> 当m=16,N=31,输出应为1f。</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"> 当m=26,N= 70 ,输出应为2i。</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"> 当m=21,N=62,输出应为2k。</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"> </span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;">3.已知数组A[N],当然数组很大,数组元素值为整数,有正有负,求使连续下标区间内所有元素和最大的值。(附加项:记录区间下标)</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;">例如:A[0]=-1,A[1]=8,A[2]=3,A[3]=-6</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(0,0)=-1</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(0,1)=7</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(0,2)=10</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(0,3)=4</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(1,1)=8</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(1,2)=11</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(1,3)=5</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(2,3)=-3</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A(3,3)=-6</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;">输出值为A(1,2),11。</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;">4.求一个数组A[N]内,输出所有不满足当下标i<j时,而数组元素值A[i]>A[j]的所有元素值和下标对。(貌似是这个意思,有少许改动)</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>例如:</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A[0]=5,A[1]=3,A[2]=4,A[3]=2,A[4]=3</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>输出</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span>A[1]和A[2],A[1]和A[4],A[3]和A[4]。</span></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><br></span>
<span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 13px;"><span style="line-height: 20px;"><span style="white-space: pre;"></span></span></span>