JAVA±à³ÌÌâÈ«¼¯(100Ìâ¼°´ð°¸) ÏÂÔر¾ÎÄ

}

for(int i=0; i

System.out.print(\λÒƺóµÄÊý×éÊÇ£º\ for(int i=0; i

System.out.print(a[i] + \ } } }

¡¾³ÌÐò37¡¿

ÌâÄ¿£ºÓÐn¸öÈËΧ³ÉһȦ£¬Ë³ÐòÅźš£´ÓµÚÒ»¸öÈË¿ªÊ¼±¨Êý£¨´Ó1µ½3±¨Êý£©£¬·²±¨µ½3µÄÈËÍ˳öȦ×Ó£¬ÎÊ×îºóÁôϵÄÊÇÔ­À´µÚ¼¸ºÅµÄÄÇλ¡£ import java.util.Scanner; public class lianxi37 {

public static void main(String[] args) { Scanner s = new Scanner(System.in);

System.out.print(\ÇëÊäÈëÅųÉһȦµÄÈËÊý£º\ int n = s.nextInt();

boolean[] arr = new boolean[n]; for(int i=0; i

int leftCount = n; int countNum = 0; int index = 0;

while(leftCount > 1) { if(arr[index] == true) { countNum ++;

if(countNum == 3) { countNum =0;

arr[index] = false; leftCount --; } }

index ++;

if(index == n) { index = 0; } }

for(int i=0; i

System.out.println(\Ô­ÅÅÔÚµÚ\λµÄÈËÁôÏÂÁË¡£\ }

} } }

¡¾³ÌÐò38¡¿

ÌâÄ¿£ºÐ´Ò»¸öº¯Êý£¬ÇóÒ»¸ö×Ö·û´®µÄ³¤¶È£¬ÔÚmainº¯ÊýÖÐÊäÈë×Ö·û´®£¬²¢Êä³öÆ䳤¶È¡£ /*??????

*??ÌâÄ¿Òâ˼Ëƺõ²»ÄÜÓÃlength()º¯Êý */ import java.util.*; public class lianxi38 {

public static void main(String[] args) { Scanner s = new Scanner(System.in);

System.out.println(\ÇëÊäÈëÒ»¸ö×Ö·û´®£º\ String str = s.nextLine();

System.out.println(\×Ö·û´®µÄ³¤¶ÈÊÇ£º\ } }

¡¾³ÌÐò39¡¿

ÌâÄ¿£º±àдһ¸öº¯Êý£¬ÊäÈënΪżÊýʱ£¬µ÷Óú¯ÊýÇó1/2+1/4+...+1/n,µ±ÊäÈënΪÆæÊýʱ£¬µ÷Óú¯Êý1/1+1/3+...+1/n(ÀûÓÃÖ¸Õ뺯Êý) //ûÓÐÀûÓÃÖ¸Õ뺯Êý import java.util.*; public class lianxi39 {

public static void main(String[] args) { Scanner s = new Scanner(System.in);

System.out.print(\ÇëÊäÈëÒ»¸öÕýÕûÊý n= \ int n = s.nextInt();

System.out.println(\ÏàÓ¦ÊýÁеĺÍΪ£º\ }

public static double sum(int n) { double res = 0; if(n % 2 == 0) {

for(int i=2; i<=n; i+=2) { res += (double)1 / i; }

} else {

for(int i=1; i<=n; i+=2) { res += (double)1 / i ; } }

return res; } }

¡¾³ÌÐò40¡¿

ÌâÄ¿£º×Ö·û´®ÅÅÐò¡£

public class lianxi40 {

public static void main(String[] args) { int N=5;

String temp = null;

String[] s = new String[N]; s[0] = \ s[1] = \ s[2] = \ s[3] = \ s[4] = \

for(int i=0; i

if(compare(s[i], s[j]) == false) { temp = s[i]; s[i] = s[j]; s[j] = temp; } } }

for(int i=0; i

static boolean compare(String s1, String s2) { boolean result = true;

for(int i=0; i s2.charAt(i)) { result = false; break;

} else if(s1.charAt(i)

if(s1.length() < s2.length()) { result = true; } else {

result = false; } } }

return result; } }

¡¾³ÌÐò41¡¿

ÌâÄ¿£ºº£Ì²ÉÏÓÐÒ»¶ÑÌÒ×Ó£¬ÎåÖ»ºï×ÓÀ´·Ö¡£µÚÒ»Ö»ºï×Ó°ÑÕâ¶ÑÌÒ×Óƾ¾Ý·ÖΪÎå·Ý£¬¶àÁËÒ»¸ö£¬ÕâÖ»ºï×ӰѶàµÄÒ»¸öÈÓÈ뺣ÖУ¬ÄÃ×ßÁËÒ»·Ý¡£µÚ¶þÖ»ºï×Ó°ÑʣϵÄÌÒ×ÓÓÖƽ¾ù·Ö³ÉÎå·Ý£¬ÓÖ¶àÁËÒ»¸ö£¬ËüͬÑù°Ñ¶àµÄÒ»¸öÈÓÈ뺣ÖУ¬ÄÃ×ßÁËÒ»·Ý£¬µÚÈý¡¢µÚËÄ¡¢µÚÎåÖ»ºï×Ó¶¼ÊÇÕâÑù×öµÄ£¬Îʺ£Ì²ÉÏÔ­À´×îÉÙÓжàÉÙ¸öÌÒ×Ó£¿ public class lianxi41 {

public static void main (String[] args) { int i,m,j=0,k,count; for(i=4;i<10000;i+=4) { count=0; m=i;

for(k=0;k<5;k++) {

j=i/4*5+1; i=j;

if(j%4==0) count++; else break; } i=m; if(count==4)

{System.out.println(\Ô­ÓÐÌÒ×Ó \¸ö\break;} } } }

¡¾³ÌÐò42¡¿

ÌâÄ¿£º809*??=800*??+9*??+1 ÆäÖÐ??´ú±íµÄÁ½Î»Êý,8*??µÄ½á¹ûΪÁ½Î»Êý£¬9*??µÄ½á¹ûΪ3λÊý¡£Çó??´ú±íµÄÁ½Î»Êý£¬¼°809*??ºóµÄ½á¹û¡£

//ÌâÄ¿´íÁË£¡809x=800x+9x+1 ÕâÑùµÄ·½³ÌÎ޽⡣ȥµôÄǸö1¾ÍÓнâÁË¡£ public class lianxi42 {

public static void main (String[] args) { int a=809,b,i; for(i=10;i<13;i++) {b=i*a ;

if(8*i<100&&9*i>=100)

System.out.println (\} }

¡¾³ÌÐò43¡¿

ÌâÄ¿£ºÇó0¡ª7ËùÄÜ×é³ÉµÄÆæÊý¸öÊý¡£ //×é³É1λÊýÊÇ4¸ö¡£ //×é³É2λÊýÊÇ7*4¸ö¡£ //×é³É3λÊýÊÇ7*8*4¸ö¡£ //×é³É4λÊýÊÇ7*8*8*4¸ö¡£