您好,欢迎访问三七文档
当前位置:首页 > 中学教育 > 高中教育 > 浙大java练习题答案-40001-50004
40001importjava.util.Scanner;publicclassTest40001{publicstaticvoidmain(String[]args){intri,repeat;inti,n;floatsum;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){n=in.nextInt();/*--------------------*/System.out.println((int)(sum*1000+0.5)/1000.);}}}40002importjava.util.Scanner;publicclassTest40002{publicstaticvoidmain(String[]args){intri,repeat;inti,n;doublefact;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){n=in.nextInt();/*--------------------*/System.out.println(fact);}}}40003importjava.util.Scanner;publicclassTest40003{publicstaticvoidmain(String[]args){intri,repeat;inti,n;doublex,mypow;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){x=in.nextDouble();n=in.nextInt();/*--------------------*/System.out.println(mypow);}}}40004importjava.util.Scanner;publicclassTest40004{publicstaticvoidmain(String[]args){intri,repeat;inti,n,flag;floatsum;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){n=in.nextInt();/*--------------------*/System.out.println((long)(sum*10000+0.5)/10000.);}}}40005importjava.util.Scanner;publicclassTest40005{publicstaticvoidmain(String[]args){intri,repeat;inti,n,temp;floatsum;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){n=in.nextInt();/*--------------------*/sum=0;for(i=1;i=n;i++){sum=(float)(sum+1.0/(2*i-1));}System.out.println(sum);}}}40006importjava.util.Scanner;publicclassTest40006{publicstaticvoidmain(String[]args){intri,repeat;inttemp,flag;doubleeps,item,sum;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){eps=in.nextDouble();/*--------------------*/System.out.println((int)(sum*10000+0.5)/10000.);}}}40007importjava.util.Scanner;publicclassTest40007{publicstaticvoidmain(String[]args){intri,repeat;intbegin,c,end,f;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){begin=in.nextInt();end=in.nextInt();System.out.println(CelsiusFahrenheit);/*--------------------*/System.out.println(c++f);}}}}40008importjava.util.Scanner;publicclassTest40008{publicstaticvoidmain(String[]args){intri,repeat;intx,sum;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){x=in.nextInt();/*--------------------*/}System.out.println(sum);}}}40009importjava.util.Scanner;publicclassTest40009{publicstaticvoidmain(String[]args){intri,repeat;inti,max,n,x;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){n=in.nextInt();/*--------------------*/}System.out.println(max);}}}40010importjava.util.Scanner;publicclassTest40010{publicstaticvoidmain(String[]args){intri,repeat;intnumber,sum,n,r;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){n=in.nextInt();/*--------------------*/System.out.println(number=+number+,sum=+sum);}}}40011importjava.util.Scanner;publicclassTest40011{publicstaticvoidmain(String[]args){intri,repeat;inti,n;floata,b,s,t;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){n=in.nextInt();/*--------------------*/System.out.println((int)(s*10000+.5)/10000.);}}}40012importjava.util.Scanner;publicclassTest40012{publicstaticvoidmain(Stringargs[]){intri,repeat;inti,n,a,sn,tn;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){a=in.nextInt();n=in.nextInt();/*--------------------*/System.out.println(sn);}}}40013importjava.util.Scanner;publicclassTest40013{publicstaticvoidmain(Stringargs[]){intri,repeat;inti,m,n;booleanflag=true;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){m=in.nextInt();/*--------------------*/}if(flag)System.out.println(YES);elseSystem.out.println(NO);}}}40014importjava.util.*;publicclassTest40014{publicstaticvoidmain(String[]args){Scannerin=newScanner(System.in);intgcd,lcm,m,n,r;intrepeat,ri;repeat=in.nextInt();for(ri=1;ri=repeat;ri++){m=in.nextInt();n=in.nextInt();if(m=0||n=0)System.out.println(m=0orn=0);else{/*---------*/System.out.println(theleastcommonmultiple:+lcm+,thegreatestcommondivisor:+gcd);}}}}40021importjava.util.Scanner;publicclassTest40021{publicstaticvoidmain(Stringargs[]){intri,repeat;inti,n;floats,t;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){n=in.nextInt();/*--------------------*/System.out.println((int)(s*10000+0.5)/10000.);}}}40022importjava.util.Scanner;publicclassTest40022{publicstaticvoidmain(Stringargs[]){intri,repeat;inti,digit,m,n,number,sum;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){m=in.nextInt();n=in.nextInt();/*------------------*/}}}40023importjava.util.Scanner;publicclassTest40023{publicstaticvoidmain(Stringargs[]){intri,repeat;intcount,i,j,k,m,n,sum;Scannerin=newScanner(System.in);repeat=in.nextInt();for(ri=1;ri=repeat;ri++){m=in.nextInt();n=in.nextInt();/*---------------------*/System.out.println(count=+count+,sum=+sum);}}}40031importjava.util.Scanner;publicclassTest40031{publicstaticvoidmain(String[]args){intri,repeat,cou
本文标题:浙大java练习题答案-40001-50004
链接地址:https://www.777doc.com/doc-4906276 .html