欢迎来到天天文库
浏览记录
ID:49536901
大小:123.00 KB
页数:16页
时间:2020-03-02
《华为上机题目总结.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、试题一:输入字符串长度len1,字符串s1,字符串长度len2,字符串s2。从后向前比较,以最短字符串为标准,输出不同的元素的个数。例如:输入:s1="1,3,5"len1=3s2="2,4,1,7,5"len2=5输出:1publicclassTest1{publicstaticvoidmain(String[]args){Stringstr1="1,3,5";Stringstr2="2,1,6,5";System.out.println(getDifferentNumber(str1,3,str2,4));}publicstaticintg
2、etDifferentNumber(Stringstr1,intlen1,Stringstr2,intlen2){intcount=0;intlen=0;len=(len13、计数,当数到m个元素时,m个元素出列,然后将出列的数字赋值给m。然后从下一个数计数循环,直到所有数字都出列,给定的数全部为大于0的数字。输出出队队列。publicclassJosephus_Seq{publicstaticvoidmain(String[]args){Josephusjo=newJosephus(newint[]{3,1,6,2,5});jo.ShowInfo();System.out.println();jo.doJosephus(3);}}classNode{publicintnum;publicNodenext;publi4、cNode(inti){this.num=i;this.next=null;}}classJosephus{publicNodehead;publicJosephus(int[]data){Nodep=newNode(data[0]);head=p;for(inti=1;i5、{for(inti=1;i6、s);}publicintverifyMsisdn(Stringnum){intres=0;char[]ch=num.toCharArray();if(ch.length<13)return1;for(inti=0;i7、]obj=newObject[16];privateintsize=0;publicbooleanisEmpty(){returnsize==0;}publicvoidclear(){for(inti=0;i8、l;}obj=temp;}publicbooleanpush(Objectdata){if(size>=obj.length){resize();}o
3、计数,当数到m个元素时,m个元素出列,然后将出列的数字赋值给m。然后从下一个数计数循环,直到所有数字都出列,给定的数全部为大于0的数字。输出出队队列。publicclassJosephus_Seq{publicstaticvoidmain(String[]args){Josephusjo=newJosephus(newint[]{3,1,6,2,5});jo.ShowInfo();System.out.println();jo.doJosephus(3);}}classNode{publicintnum;publicNodenext;publi
4、cNode(inti){this.num=i;this.next=null;}}classJosephus{publicNodehead;publicJosephus(int[]data){Nodep=newNode(data[0]);head=p;for(inti=1;i5、{for(inti=1;i6、s);}publicintverifyMsisdn(Stringnum){intres=0;char[]ch=num.toCharArray();if(ch.length<13)return1;for(inti=0;i7、]obj=newObject[16];privateintsize=0;publicbooleanisEmpty(){returnsize==0;}publicvoidclear(){for(inti=0;i8、l;}obj=temp;}publicbooleanpush(Objectdata){if(size>=obj.length){resize();}o
5、{for(inti=1;i6、s);}publicintverifyMsisdn(Stringnum){intres=0;char[]ch=num.toCharArray();if(ch.length<13)return1;for(inti=0;i7、]obj=newObject[16];privateintsize=0;publicbooleanisEmpty(){returnsize==0;}publicvoidclear(){for(inti=0;i8、l;}obj=temp;}publicbooleanpush(Objectdata){if(size>=obj.length){resize();}o
6、s);}publicintverifyMsisdn(Stringnum){intres=0;char[]ch=num.toCharArray();if(ch.length<13)return1;for(inti=0;i7、]obj=newObject[16];privateintsize=0;publicbooleanisEmpty(){returnsize==0;}publicvoidclear(){for(inti=0;i8、l;}obj=temp;}publicbooleanpush(Objectdata){if(size>=obj.length){resize();}o
7、]obj=newObject[16];privateintsize=0;publicbooleanisEmpty(){returnsize==0;}publicvoidclear(){for(inti=0;i8、l;}obj=temp;}publicbooleanpush(Objectdata){if(size>=obj.length){resize();}o
8、l;}obj=temp;}publicbooleanpush(Objectdata){if(size>=obj.length){resize();}o
此文档下载收益归作者所有