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

TOP

×îÐÂJAVA±à³ÌÌâÈ«¼¯_50Ìâ¼°´ð°¸(Èý)
2014-11-24 02:23:10 ¡¾´ó ÖРС¡¿ ä¯ÀÀ:4470´Î
Tags£º×îРJAVA ±à³Ì È«¼¯ _50 ´ð°¸
¡¿
ÌâÄ¿£ºÊäÈëÒ»ÐÐ×Ö·û£¬·Ö±ðͳ¼Æ³öÆäÖÐÓ¢ÎÄ×Öĸ¡¢¿Õ¸ñ¡¢Êý×ÖºÍÆäËü×Ö·ûµÄ¸öÊý¡£
import java.util.*;
public class lianxi07 {
public static void main(String[] args) {
int digital = 0;
int character = 0;
int other = 0;
int blank = 0;
char[] ch = null;
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
ch = s.toCharArray();
for(int i=0; i if(ch >= ¡¯0¡ä && ch <= ¡¯9¡ä) {
digital ++;
} else if((ch >= ¡®a¡¯ && ch <= ¡®z¡¯) || ch > ¡®A¡¯ && ch <= ¡®Z¡¯) {
character ++;
} else if(ch == ¡® ¡®) {
blank ++;
} else {
other ++;
}
}
System.out.println(¡°Êý×Ö¸öÊý: ¡± + digital);
System.out.println(¡°Ó¢ÎÄ×Öĸ¸öÊý: ¡± + character);
System.out.println(¡°¿Õ¸ñ¸öÊý: ¡± + blank);
System.out.println(¡°ÆäËû×Ö·û¸öÊý:¡± + other );


}}


¡¾³ÌÐò8¡¿
ÌâÄ¿£ºÇós=a+aa+aaa+aaaa+aa¡­aµÄÖµ£¬ÆäÖÐaÊÇÒ»¸öÊý×Ö¡£ÀýÈç2+22+222+2222+22222(´Ëʱ¹²ÓÐ5¸öÊýÏà¼Ó)£¬¼¸¸öÊýÏà¼ÓÓмüÅÌ¿ØÖÆ¡£
import java.util.*;
public class lianxi08 {
public static void main(String[] args) {
long a , b = 0, sum = 0;
Scanner s = new Scanner(System.in);
System.out.print(¡°ÊäÈëÊý×ÖaµÄÖµ£º ¡°);
a = s.nextInt();
System.out.print(¡°ÊäÈëÏà¼ÓµÄÏîÊý£º¡±);
int n = s.nextInt();
int i = 0;
while(i < n) {
b = b + a;
sum = sum + b;
a = a * 10;
++ i;
}
System.out.println(sum);
}}
¡¾³ÌÐò9¡¿
ÌâÄ¿£ºÒ»¸öÊýÈç¹ûÇ¡ºÃµÈÓÚËüµÄÒò×ÓÖ®ºÍ£¬Õâ¸öÊý¾Í³ÆΪ ¡°ÍêÊý ¡°¡£ÀýÈç6=1£«2£«3.±à³Ì ÕÒ³ö1000ÒÔÄÚµÄËùÓÐÍêÊý¡£
public class lianxi09 {
public static void main(String[] args) {
System.out.println(¡°1µ½1000µÄÍêÊýÓУº ¡°);
for(int i=1; i<1000; i++) {
int t = 0;
for(int j=1; j<= i/2; j++) {
if(i % j == 0) {
t = t + j;
}
}
if(t == i) {
System.out.print(i + ¡° ¡°);
} }}


¡¾³ÌÐò10¡¿
ÌâÄ¿£ºÒ»Çò´Ó100Ã׸߶È×ÔÓÉÂäÏ£¬Ã¿´ÎÂäµØºó·´Ìø»ØÔ­¸ß¶ÈµÄÒ»°ë£»ÔÙÂäÏ£¬ÇóËüÔÚ µÚ10´ÎÂäµØʱ£¬¹²¾­¹ý¶àÉÙÃ×£¿µÚ10´Î·´µ¯¶à¸ß£¿
public class lianxi10 {
public static void main(String[] args) {
double h = 100,s = 100;
for(int i=1; i<10; i++) {
s = s + h;
h = h / 2;
}
System.out.println(¡°¾­¹ý·³Ì£º¡± + s);
System.out.println(¡°·´µ¯¸ß¶È£º¡± + h / 2);
}}
¡¾³ÌÐò11¡¿
ÌâÄ¿£ºÓÐ1¡¢2¡¢3¡¢4ËĸöÊý×Ö£¬ÄÜ×é³É¶àÉÙ¸ö»¥²»ÏàͬÇÒÎÞÖظ´Êý×ÖµÄÈýλÊý£¿¶¼ÊǶàÉÙ£¿
public class lianxi11 {
public static void main(String[] args) {
int count = 0;
for(int x=1; x<5; x++) {
for(int y=1; y<5; y++) {
for(int z=1; z<5; z++) {
if(x != y && y != z && x != z) {
count ++;
System.out.println(x*100 + y*10 + z );
} } } }
System.out.println(¡°¹²ÓС± + count + ¡°¸öÈýλÊý¡±);
}}
¡¾³ÌÐò12¡¿
ÌâÄ¿£ºÆóÒµ·¢·ÅµÄ½±½ð¸ù¾ÝÀûÈóÌá³É¡£ÀûÈó(I)µÍÓÚ»òµÈÓÚ10ÍòԪʱ£¬½±½ð¿ÉÌá10%£»ÀûÈó¸ßÓÚ10ÍòÔª£¬µÍÓÚ20ÍòԪʱ£¬µÍÓÚ10ÍòÔªµÄ²¿·Ö°´10%Ìá³É£¬¸ßÓÚ10ÍòÔªµÄ²¿·Ö£¬¿É¿ÉÌá³É7.5%£»20Íòµ½40ÍòÖ®¼äʱ£¬¸ßÓÚ20ÍòÔªµÄ²¿·Ö£¬¿ÉÌá³É5%£»40Íòµ½60ÍòÖ®¼äʱ¸ßÓÚ40ÍòÔªµÄ²¿·Ö£¬¿ÉÌá³É3%£»60Íòµ½100ÍòÖ®¼äʱ£¬¸ßÓÚ60ÍòÔªµÄ²¿·Ö£¬¿ÉÌá³É1.5%£¬¸ßÓÚ100ÍòԪʱ£¬³¬¹ý100ÍòÔªµÄ²¿·Ö°´1%Ìá³É£¬´Ó¼üÅÌÊäÈëµ±ÔÂÀûÈó£¬ÇóÓ¦·¢·Å½±½ð×ÜÊý£¿
import java.util.*;
public class lianxi12 {
public static void main(String[] args) {
double x = 0,y = 0;
System.out.print(¡°ÊäÈëµ±ÔÂÀûÈó£¨Íò£©£º¡±);
Scanner s = new Scanner(System.in);
x = s.nextInt();
if(x > 0 && x <= 10) {
y = x * 0.1;
} else if(x > 10 && x <= 20) {
y = 10 * 0.1 + (x ¨C 10) * 0.075;
} else if(x > 20 && x <= 40) {
y = 10 * 0.1 + 10 * 0.075 + (x ¨C 20) * 0.05;
} else if(x > 40 && x <= 60) {
y = 10 * 0.1 + 10 * 0.075 + 20 * 0.05 + (x ¨C 40) * 0.03;
} else if(x > 60 && x <= 100) {
y = 20 * 0.175 + 20 * 0.05 + 20 * 0.03 + (x ¨C 60) * 0.015;
} else if(x > 100) {
y = 20 * 0.175 + 40 * 0.08 + 40 * 0.015 + (x ¨C 100) * 0.01;
}
System.out.println(¡°Ó¦¸ÃÌáÈ¡µÄ½±½ðÊÇ ¡± + y + ¡°Íò¡±);
}}


¡¾³ÌÐò13¡¿
ÌâÄ¿£ºÒ»¸öÕûÊý£¬Ëü¼ÓÉÏ100ºóÊÇÒ»¸öÍêȫƽ·½Êý£¬ÔÙ¼ÓÉÏ168ÓÖÊÇÒ»¸öÍêȫƽ·½Êý£¬ÇëÎʸÃÊýÊǶàÉÙ£¿
public class lianxi13 {
public static void main(String[] args) {
for(int x =1; x<100000; x++) {
if(Math.sqrt(x+100) % 1 == 0) {
if(Math.sqrt(x+268) % 1 == 0) {
System.out.println(x + ¡°¼Ó100ÊÇÒ»¸öÍêȫƽ·½Êý£¬ÔÙ¼Ó168ÓÖÊÇÒ»¸öÍêȫƽ·½Êý¡±);
} } }}}
/*°´ÌâÒâÑ­»·Ó¦¸Ã´Ó-100¿ªÊ¼£¨ÕûÊý°üÀ¨ÕýÕûÊý¡¢¸ºÕûÊý¡¢Á㣩£¬ÕâÑù»á¶àÒ»¸öÂú×ãÌõ¼þµÄÊý-99¡£
µ«ÊÇÎÒ¿´µ½´ó²¿·ÖÈ˽âÕâµÀÌâĿʱ¶¼°ÑÌâÖеġ°ÕûÊý¡±Àí½â³ÉÕýÕûÊý£¬ÎÒÒ²¾ÍËæ´óÁ÷ÁË¡£*/
¡¾³ÌÐò14¡¿
ÌâÄ¿£ºÊäÈëijÄêijÔÂijÈÕ£¬ÅжÏÕâÒ»ÌìÊÇÕâÒ»ÄêµÄµÚ¼¸Ì죿
import java.util.*;
public class lianxi14 {
public static void main(String[] args) {
int year, month, day;
int days = 0;
int d = 0;
int e;
input fymd = new input();
do {
e = 0;
System.out.print(¡°ÊäÈëÄ꣺¡±);
year =fymd.input();
System.out.print(¡°ÊäÈëÔ£º¡±);
month = fymd.input();
System.out.print(¡°ÊäÈëÌ죺¡±);
day = fymd.input();
if (year < 0 || month < 0 || month > 12 || day < 0 || day > 31) {
System.out.println(¡°ÊäÈë´íÎó£¬ÇëÖØÐÂÊäÈ룡¡±);
e

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

×îÐÂÎÄÕÂ

ÈÈÃÅÎÄÕÂ

Hot ÎÄÕÂ

Python

C ÓïÑÔ

C++»ù´¡

´óÊý¾Ý»ù´¡

linux±à³Ì»ù´¡

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