1、 for (i=0;ii+) pi=1; for (j=0;jaij; if(isgood(i+1)=0) pi=0;(n-1); if(pi!=0) couti+1 ; coutendl; return 0;int isgood(int pos)/由于对角线元素无法对零件好坏的识别提供参考依据,所以每次循环都必须把i=j,或者pos-1=i的情况排除掉; int i,j,s=0;/好的零件数量必须大于坏的,否者说明pos判断失误 s+=apos-1i; if (2*s=n) return 0;/除了主对角线以外的函数,如果pos判断i是好的,但是i却判断pos是坏的,说明判断失误 if(ap
2、os-1i=1&i!=(pos-1)&aipos-1=0) return 0; /在对角线以外,如果pos判断了i是正确的,那么i对其他零件的判断必须与pos相同,否者说明判断失误=(pos-1) for (j=0; if (i!=j&j!aij!=apos-1j) return 0; /如果i已经被确定为坏的,但是pos却将其判断为好的,说明判断失误 if(pi=0&apos-1i=1& return pos;最近FJ为他的奶牛们开设了数学分析课,FJ知道若要学好这门课,必须有一个好的三角函数基本功。所以他准备和奶牛们做一个“Sine之舞”的游戏,寓教于乐,提高奶牛们的计算能力。不妨设An=
3、sin(1sin(2+sin(3sin(4+.sin(n).)Sn=(.(A1+n)A2+n-1)A3+.+2)An+1FJ想让奶牛们计算Sn的值,请你帮助FJ打印出Sn的完整表达式,以方便奶牛们做题。仅有一个数:N201。请输出相应的表达式Sn,以一个换行符结束。输出中不得含有多余的空格或换行、回车符。(sin(1)+3)sin(1sin(2)+2)sin(1sin(2+sin(3)+1程序:#include stdlib.hstring num2str(double i) stringstream ss; ss=1;i-) q=(+q+(isnumerical?A(n-i+1):A+num
4、2str(n-i+1)+num2str(i); return q;int string2int(string str) return (int)atof(str.c_str();int str2num(string s) int num; stringstream ss(s); ssnum; return num; int N;N;N=A(N)=A(N)S(N)=S(N,false)S(N,true)Tom教授正在给研究生讲授一门关于基因的课程,有一件事情让他颇为头疼:一条染色体上有成千上万个碱基对,它们从0开始编号,到几百万,几千万,甚至上亿。比如说,在对学生讲解第1234567009号位置
5、上的碱基时,光看着数字是很难准确的念出来的。所以,他迫切地需要一个系统,然后当他输入12 3456 7009时,会给出相应的念法:十二亿三千四百五十六万七千零九用汉语拼音表示为shi er yi san qian si bai wu shi liu wan qi qian ling jiu这样他只需要照着念就可以了。你的任务是帮他设计这样一个系统:给定一个阿拉伯数字串,你帮他按照中文读写的规范转为汉语拼音字串,相邻的两个音节用一个空格符格开。注意必须严格按照规范,比如说“10010”读作“yi wan ling yi shi”而不是“yi wan ling shi”,“100000”读作“sh
6、i wan”而不是“yi shi wan”,“2000”读作“er qian”而不是“liang qian”。有一个数字串,数值大小不超过2,000,000,000。是一个由小写英文字母,逗号和空格组成的字符串,表示该数的英文读法。1234567009shi er yi san qian si bai wu shi liu wan qi qian ling jiustring shu10=ling,yiersansiwuliuqibanum;string bei4= shi bai qianstring beibig14= wan yi zao jing gai zi rang gou jia
7、n zheng zai ji henghesha/string shu10=零一二三四五六七八九/string bei4=十百千/string beibig19=万亿兆京垓秭穰沟涧正载极恒河沙阿僧祗那由他不可思议无量大数int car2int(char car) return car-0string shu1_4(string p)/19999,包括0001,9999; int wei,i,temp=0; wei=p.length();wei;i+) if(pi=) temp+; else break; if (temp=wei) if(temp!=0&tempreadnum&readnum!
8、=break cout读作:shu1_n(readnum)给定一条标有整点(1, 2, 3, .)的射线. 定义两个点之间的距离为其下标之差的绝对值.Laharl, Etna, Flonne一开始在这条射线上不同的三个点, 他们希望其中某个人能够到达下标最大的点.每个角色只能进行下面的3种操作, 且每种操作不能每人不能进行超过一次.1.移动一定的距离2.把另一个角色高举过头3.将举在头上的角色扔出一段距离每个角色有一个movement range参数, 他们只能移动到没有人的位置, 并且起点和终点的距离不超过movement range.如果角色A和另一个角色B距离为1, 并且角色B没有被别的
9、角色举起, 那么A就能举起B. 同时, B会移动到A的位置,B原来所占的位置变为没有人的位置. 被举起的角色不能进行任何操作, 举起别人的角色不能移动.同时, 每个角色还有一个throwing range参数, 即他能把举起的角色扔出的最远的距离. 注意, 一个角色只能被扔到没有别的角色占据的位置. 我们认为一个角色举起另一个同样举起一个角色的角色是允许的. 这种情况下会出现3个人在同一个位置的情况. 根据前面的描述, 这种情况下上面的两个角色不能进行任何操作, 而最下面的角色可以同时扔出上面的两个角色. 你的任务是计算这些角色能够到达的位置的最大下标, 即最大的数字x, 使得存在一个角色能够
10、到达x.输入共三行, 分别为Laharl, Etna, Floone的信息.每一行有且仅有3个整数, 描述对应角色的初始位置, movement range, throwing range.数据保证3个角色的初始位置两两不相同且所有的数字都在1到10之间.仅有1个整数, 即Laharl, Etna, Flonne之一能到达的最大距离.9 3 34 3 12 3 315样例说明一开始Laharl在位置9, Etna在位置4, Flonne在位置2.首先, Laharl移动到6.然后Flonne移动到位置5并且举起Etna.Laharl举起Flonne将其扔到位置9.Flonne把Etna扔到位置
11、12.Etna移动到位置15.英文题目:E. Lift and Throwtime limit per test 1.5 secondsmemory limit per test 256 megabytesInput standard inputOutput standard outputYou are given a straight half-line divided into segments of unit length, which we will call positions. The positions are numbered by positive integers that
12、 start with1from the end of half-line, i. e.1,2,3and so on. The distance between the positions is the absolute difference between the respective numbers.Laharl, Etna and Flonne occupy some positions on the half-line and they want to get to the position with the largest possible number. They are orig
13、inally placed in different positions.Each of the characters can perform each of the following actionsno more than once: Move a certain distance. Grab another character and lift him above the head. Throw the lifted character a certain distance.Each character has amovement rangeparameter. They can onl
14、y move to free positions, assuming that distance between those positions doesnt exceed the movement range.One character can lift another character if the distance between the two characters equals1, and no one already holds that another character. We can assume that the lifted character moves to the
15、 same position as the person who has lifted him, and the position in which he stood before becomes free. A lifted character cannot perform any actions and the character that holds him cannot walk.Also, each character has athrowing rangeparameter. It is the distance at which this character can throw
16、the one lifted above his head. He can only throw a character to a free position, and only when there is a lifted character.We accept the situation when one person grabs another one who in his turn has the third character in his hands. This forms a column of three characters. For example, Laharl can
17、hold Etna while Etna holds Flonne. In this case, Etna and the Flonne cannot perform any actions, and Laharl can only throw Etna (together with Flonne) at some distance.Laharl, Etna and Flonne perform actions in any order. They perform actions in turns, that is no two of them can do actions at the sa
18、me time.Determine the maximum number of position at least one of the characters can reach. That is, such maximal numberxso that one of the characters can reach positionx.InputThe first line contains three integers: Laharls position, his movement range and throwing range. The second and the third lin
19、es describe Etnas and Flonnes parameters correspondingly in the similar form. It is guaranteed that the three characters occupy distinct positions. All numbers in the input are betweenand10, inclusive.OutputPrint a single number the maximum ordinal number of position which either Laharl, Etna or Flo
20、nne can reach.Sample test(s)inputoutputNoteLet us explain how to reach position15in the sample.Initially Laharl occupies position9, Etna position4and Flonne position2.First Laharl moves to position6.Then Flonne moves to position5and grabs Etna.Laharl grabs Flonne and throws to position9.Flonne throws Etna to position12.Etna moves to position15.Codecstdiocstring#incl
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1