ÉèΪÊ×Ò³ ¼ÓÈëÊÕ²Ø

TOP

×îÐÂJAVA±à³ÌÌâÈ«¼¯_50Ìâ¼°´ð°¸(ËÄ)
2014-11-24 02:23:10 ¡¾´ó ÖРС¡¿ ä¯ÀÀ:4410´Î
Tags£º×îРJAVA ±à³Ì È«¼¯ _50 ´ð°¸
=1 ;
}
}while( e==1);
for (int i=1; i switch (i) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
days = 31;
break;
case 4:
case 6:
case 9:
case 11:
days = 30;
break;
case 2:
if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)) {
days = 29;
} else {
days = 28;
}
break;
}
d += days;
}
System.out.println(year + ¡°-¡± + month + ¡°-¡± + day + ¡°ÊÇÕâÄêµÄµÚ¡± + (d+day) + ¡°Ìì¡£¡±);
}
}
class input{
public int input() {
int value = 0;
Scanner s = new Scanner(System.in);
value = s.nextInt();
return value;
}}


¡¾³ÌÐò15¡¿
ÌâÄ¿£ºÊäÈëÈý¸öÕûÊýx,y,z£¬Çë°ÑÕâÈý¸öÊýÓÉСµ½´óÊä³ö¡£
import java.util.*;
public class lianxi15 {
public static void main(String[] args) {
input fnc = new input();
int x=0, y=0, z=0;
System.out.print(¡°ÊäÈëµÚÒ»¸öÊý×Ö£º¡±);
x = fnc.input();
System.out.print(¡°ÊäÈëµÚ¶þ¸öÊý×Ö£º¡±);
y = fnc.input();
System.out.print(¡°ÊäÈëµÚÈý¸öÊý×Ö£º¡±);
z = fnc.input();
if(x > y) {
int t = x;
x = y;
y = t;
}
if(x > z) {
int t = x;
x = z;
z = t;
}
if(y > z) {
int t = y;
y = z;
z = t;
}
System.out.println( ¡°Èý¸öÊý×ÖÓÉСµ½´óÅÅÁÐΪ£º ¡°+x + ¡± ¡± + y + ¡± ¡± + z);
}
}
class input{
public int input() {
int value = 0;
Scanner s = new Scanner(System.in);
value = s.nextInt();
return value;
}}
¡¾³ÌÐò16¡¿
ÌâÄ¿£ºÊä³ö9*9¿Ú¾÷¡£
public class lianxi16 {
public static void main(String[] args) {
for(int i=1; i<10; i++) {
for(int j=1; j<=i; j++) {
System.out.print(j + ¡°*¡± + i + ¡°=¡± + j*i + ¡° ¡± );
if(j*i<10){System.out.print(¡± ¡°);}
}
System.out.println();
}
}}
¡¾³ÌÐò17¡¿
ÌâÄ¿£ººï×Ó³ÔÌÒÎÊÌ⣺ºï×ÓµÚÒ»ÌìÕªÏÂÈô¸É¸öÌÒ×Ó£¬µ±¼´³ÔÁËÒ»°ë£¬»¹²»ñ«£¬ÓÖ¶à³ÔÁËÒ»¸ö µÚ¶þÌìÔçÉÏÓÖ½«Ê£ÏµÄÌÒ×Ó³ÔµôÒ»°ë£¬ÓÖ¶à³ÔÁËÒ»¸ö¡£ÒÔºóÿÌìÔçÉ϶¼³ÔÁËÇ°Ò»ÌìʣϠµÄÒ»°ëÁãÒ»¸ö¡£µ½µÚ10ÌìÔçÉÏÏëÔÙ³Ôʱ£¬¼ûֻʣÏÂÒ»¸öÌÒ×ÓÁË¡£ÇóµÚÒ»Ìì¹²ÕªÁ˶àÉÙ¡£
public class lianxi17 {
public static void main(String[] args) {
int x = 1;
for(int i=2; i<=10; i++) {
x = (x+1)*2;
}
System.out.println(¡°ºï×ÓµÚÒ»ÌìÕªÁË ¡± + x + ¡± ¸öÌÒ×Ó¡±);
}}


¡¾³ÌÐò18¡¿
ÌâÄ¿£ºÁ½¸öƹÅÒÇò¶Ó½øÐбÈÈü£¬¸÷³öÈýÈË¡£¼×¶ÓΪa,b,cÈýÈË£¬ÒÒ¶ÓΪx,y,zÈýÈË¡£ÒѳéÇ©¾ö¶¨±ÈÈüÃûµ¥¡£ÓÐÈËÏò¶ÓÔ±´òÌý±ÈÈüµÄÃûµ¥¡£a˵Ëû²»ºÍx±È£¬c˵Ëû²»ºÍx,z±È£¬Çë±à³ÌÐòÕÒ³öÈý¶ÓÈüÊÖµÄÃûµ¥¡£
public class lianxi18 {


static char[] m = { ¡®a¡¯, ¡®b¡¯, ¡®c¡¯ };
static char[] n = { ¡®x¡¯, ¡®y¡¯, ¡®z¡¯ };


public static void main(String[] args) {


for (int i = 0; i < m.length; i++) {
for (int j = 0; j < n.length; j++) {


if (m[i] == ¡®a¡¯ && n[j] == ¡®x¡¯) {


continue;


} else if (m[i] == ¡®a¡¯ && n[j] == ¡®y¡¯) {


continue;


} else if ((m[i] == ¡®c¡¯ && n[j] == ¡®x¡¯)


|| (m[i] == ¡®c¡¯ && n[j] == ¡®z¡¯)) {


continue;


} else if ((m[i] == ¡®b¡¯ && n[j] == ¡®z¡¯)


|| (m[i] == ¡®b¡¯ && n[j] == ¡®y¡¯)) {


continue;


} else


System.out.println(m[i] + ¡± vs ¡± + n[j]);


}


}


}


}


¡¾³ÌÐò19¡¿
ÌâÄ¿£º´òÓ¡³öÈçÏÂͼ°¸£¨ÁâÐΣ©
*
***
*****
*******
*****
***
*
public class lianxi19 {
public static void main(String[] args) {
int H = 7, W = 7;//¸ßºÍ¿í±ØÐëÊÇÏàµÈµÄÆæÊý
for(int i=0; i<(H+1) / 2; i++) {
for(int j=0; j System.out.print(¡± ¡°);


}
for(int k=1; k<(i+1)*2; k++) {
System.out.print(¡®*¡¯);
}
System.out.println();
}
for(int i=1; i<=H/2; i++) {
for(int j=1; j<=i; j++) {
System.out.print(¡± ¡°);
}
for(int k=1; k<=W-2*i; k++) {
System.out.print(¡®*¡¯);
}
System.out.println();
}
}}


¡¾³ÌÐò20¡¿
ÌâÄ¿£ºÓÐÒ»·ÖÊýÐòÁУº2/1£¬3/2£¬5/3£¬8/5£¬13/8£¬21/13¡­Çó³öÕâ¸öÊýÁеÄÇ°20ÏîÖ®ºÍ¡£


public class lianxi20 {
public static void main(String[] args) {
int x = 2, y = 1, t;
double sum = 0;
for(int i=1; i<=20; i++) {
sum = sum + (double)x / y;
t = y;
y = x;
x = y + t;
}
System.out.println(¡°Ç°20ÏîÏà¼ÓÖ®ºÍÊÇ£º ¡± + sum);
}}


¡¾³ÌÐò21¡¿
ÌâÄ¿£ºÇó1+2!+3!+¡­+20!µÄºÍ
public class lianxi21 {
public static void main(String[] args) {
long sum = 0;
long fac = 1;
for(int i=1; i<=20; i++) {
fac = fac * i;
sum += fac;
}
System.out.println(sum);
}}


¡¾³ÌÐò22¡¿
ÌâÄ¿£ºÀûÓõݹ鷽·¨Çó5!¡£
public class lianxi22 {
public static void main(String[] args) {
int n = 5;
rec fr = new rec();
System.out.println(n+¡±! = ¡°+fr.rec(n));
}
}
class rec{
public long rec(int n) {
long value = 0 ;
if(n ==1 ) {
value = 1;
} else {
value = n * rec(n-1);
}
return value;
}}


¡¾³ÌÐò23¡¿
ÌâÄ¿£ºÓÐ5¸öÈË×øÔÚÒ»Æð£¬ÎʵÚÎå¸öÈ˶àÉÙËꣿËû˵±ÈµÚ4¸öÈË´ó2Ëê¡£ÎʵÚ4¸öÈËËêÊý£¬Ëû˵±ÈµÚ3¸öÈË´ó2Ëê¡£ÎʵÚÈý¸öÈË£¬ÓÖ˵±ÈµÚ2ÈË´óÁ½Ëê¡£ÎʵÚ2¸öÈË£¬Ëµ±ÈµÚÒ»¸öÈË´óÁ½Ëê¡£×îºóÎʵÚÒ»¸öÈË£¬Ëû˵ÊÇ10Ëê¡£ÇëÎʵÚÎå¸öÈ˶à´ó£¿


public class lianxi23 {
public static void main(String[] args) {
int age = 10;
for(int i=2; i<=5; i++) {
age =age+2;
}
System.out.println(age);
}}


¡¾³ÌÐò24¡¿
ÌâÄ¿£º¸øÒ»¸ö²»¶àÓÚ5λµÄÕýÕûÊý£¬ÒªÇó£ºÒ»¡¢ÇóËüÊǼ¸Î»Êý

Ê×Ò³ ÉÏÒ»Ò³ 1 2 3 4 5 6 7 ÏÂÒ»Ò³ βҳ 4/9/9
¡¾´ó ÖРС¡¿¡¾´òÓ¡¡¿ ¡¾·±Ìå¡¿¡¾Í¶¸å¡¿¡¾Êղء¿ ¡¾ÍƼö¡¿¡¾¾Ù±¨¡¿¡¾ÆÀÂÛ¡¿ ¡¾¹Ø±Õ¡¿ ¡¾·µ»Ø¶¥²¿¡¿
ÉÏһƪ£ºexit£¨£©º¯ÊýºÍreturn Óï¾äÓÐʲô.. ÏÂһƪ£ºOracle DBA±ÊÊÔÌâ

×îÐÂÎÄÕÂ

ÈÈÃÅÎÄÕÂ

Hot ÎÄÕÂ

Python

C ÓïÑÔ

C++»ù´¡

´óÊý¾Ý»ù´¡

linux±à³Ì»ù´¡

C/C++ÃæÊÔÌâÄ¿