Java¾«µäÃæÊÔÌâÍƼöÒ»(´ó¼Ò¿ÉÒÔ°Ñ×Ô¼ºµÄ´ð°¸¸½ÉÏ)
µÚÒ»´Î·¢,Ñ¡¸öÄѶÈÊʵ±ÖеÄ:ÎÒ¸Õ±Ïҵʱ²Î¼ÓµÄÒ»´Î±ÊÊÔ.
Ìâ:¶ÔÈÎÒâÊäÈëÈëµÄÒ»¸ö×Ö·û´®£¬°ÑÊý×Ö´ÓСµ½´óÅÅÁУ¬×ÖĸÄæÐòÅÅÁÐ,²¢ÇÒÊäÈëºó×ÖĸÓëÊý¾Ý½»ÌæÅÅÁС£
Èç:"5s3fa72cs4z134556sdd"Ö´ÐкóΪ"z1s2s3s3f4d4d5c5a56".
´ó¼Ò¿ÉÒÔÊÔÒ»ÏÂ,¹²Í¬Ñ§Ï°Âð?ÏÂÃæÊÇÎÒµ±³¡×öµÄ,Ïëµ½ÄÄдµ½ÄÄ,Ëã·¨¿Ï¶¨²»ÓÅ,½ö¹©²Î¿¼.
import java.util.Arrays;
public class DifficultTest {
/*
* ¶ÔÈÎÒâÊäÈëÈëµÄÒ»¸ö×Ö·û´®£¬°ÑÊý×Ö´ÓСµ½´óÅÅÁУ¬×ÖĸÄæÐòÅÅÁÐ,²¢ÇÒÊäÈëºó×ÖĸÓëÊý¾Ý½»ÌæÅÅÁС£
*/
public String aMethod(String str) {
String number = "";
String str1 = "";
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) >= '0' && str.charAt(i) <= '9') {
number = number + str.charAt(i) + "";
} else {
str1 = str1 + str.charAt(i);
}
}
int[] number1 = new int[number.length()];
char[] str2 = new char[str1.length()];
for (int i = 0; i < number.length(); i++) {
number1[i] = Integer.parseInt(number.charAt(i) + "");
}
Arrays.sort(number1);
for (int i = 0; i < str1.length(); i++) {
str2[i] = str1.charAt(i);
}
Arrays.sort(str2);
String[] resStr = new String[str2.length];
for (int i = 0; i < str2.length; i++) {
resStr[i] = str2[str2.length - 1 - i] + "";
}
String total = "";
for (int i = 0; i < str.length(); i++) {
if (i % 2 == 0 && i / 2 < resStr.length) {
total = total + resStr[i / 2];
} else if (i % 2 == 1 && i / 2 < number1.length) {
total = total + number1[i / 2];
}
}
return total;
}
public static void main(String[] args) {
&nb
Ïà¹ØÎĵµ£º
ÎÒ»Ò³£¼¦¶³£¬ACÁËÒ»¸ö188ÈËACµÄÌâÄ¿£¬¿ªÊ¼ËÀ»îRE£¬ÈÃÈ˲»½ûÄԲУ¬ÀíÂÛÉÏ°´ÌâÄ¿ÃèÊö½ÓÊÕsplitµÄstringÊý×鿪µ½2×ã×ã¹»£¬µ«ÊÇHH´óÅ£»¹ÊÇÖ´×ŵÄÌá³öÁËÊý×éÔ½½çµÄ¿ÉÄÜ£¬ºóÀ´¿´ÄǸö´óСΪ5µÄÊý×éÓеãÌ«¸ðÀĘ̂£¬Ë÷ÐԸijÉ105(¿ÉÊÇÃ÷Ã÷2¸ö¾Í¹»ÁË°¡£¬°¡£¬°¡£¬°¡£¬f**k)£¬È»ºó½»£ºAC£¬¿¿¡£ÄÔ²Ð+1£¬Ôôô¿ÉÄÜÄØ£¡ÄѵÀÌâÄ¿ÃèÊöÓÖÔÚÍæÈË£¬ ......
ÅäÖÃjava »·¾³±äÁ¿ºÜ¼òµ¥ £º
Ê×ÏÈ:
1¡¢Ë«»÷“ÎҵĵçÄÔ”
2¡¢Ë«»÷“¿ØÖÆÃæ°å”
3¡¢Ë«»÷“ϵͳ”
4¡¢µã»÷“¸ß¼¶”Ñ¡Ï£¬
5¡¢µã»÷“»·¾³±äÁ¿”°´Å¥
Æä´Î:
1¡¢±äÁ¿Ãû: path
±äÁ¿Öµ: C:\jdk1.6.0\bin;
2¡¢±äÁ¿Ãû: classpath
±äÁ¿Öµ: .;%JAVA_HOME%\lib\ ......
ÊʺϳõѧÕßÀí½â
1£¬testflex.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="init()"
minWidth="955 ......
java ¼¯ºÏ¿ò¼Ü(Collection)ºÍÊý×éµÄÅÅÐò
¸ù¾ÝÔ¼¶¨£¬ÔÚʹÓÃjava±à³ÌµÄʱºòÓ¦¾¡¿ÉÄܵÄʹÓÃÏÖÓеÄÀà¿â£¬µ±È»ÄãÒ²¿ÉÒÔ×Ô¼º±àдһ¸öÅÅÐòµÄ·½·¨£¬»òÕß¿ò¼Ü£¬µ«ÊÇÓм¸¸öÈËÄÜдµÃ±ÈJDKÀïµÄ»¹ÒªºÃÄØ£¿Ê¹ÓÃÏÖÓеÄÀàµÄÁíÒ»¸öºÃ´¦ÊÇ´úÂëÒ×ÓÚÔĶÁºÍά»¤£¬ÕâƪÎÄÕÂÖ÷Òª½²µÄÊÇÈçºÎʹÓÃÏÖÓеÄÀà¿â¶ÔÊý×éºÍ¸÷ÖÖCollectionÈÝÆ÷½ø ......
½ñÌìÎÒÔÚ×ö·É»ú¡£ÎªÊ²Ã´ËµÎÒÔÚ×ö·É»úÄØ£¡ÒòΪÕâÊÇÎÒ½ø´«ÖDz¥¿ÍÒÔÀ´£¬¸öÈ˸оõ·Ç³£ÖØÒªµÄÒ»ÌÿΣ¬µ«ÊÇÎÒ²»ÄÜÒ»ÏÂ×Ó¼ÇסËùËùÓеĶ«Î÷£¬×òÌìÍíÉÏ£¬¿´ÊÓƵ¿´µ½ÍíÉÏÈýµã£¬½ñÌìÉϿκÜÏ뼯ÖÐ×¢ÒâÁ¦£¬µ«ÊÇ×îÖÕ»¹ÊÇÈ̲»×¡´òÁËî§Ë¯£¬µ«½ñÌìµÄµÄ¿Î¸øÎҵĸоõÊǷdz£¾ßÓÐÁ¬¹áÐÔ£¬Ç°ÃæµÄ¿ÎÈç¹ûÌýµÃ²»ÊǺÜÇ ......