javaÃæÊÔÌ⣬ÖÊÊýÇóºÍ
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
/**
* ÇóÖÊÊýºÍ£¬
* Èç:
* sum(1)=2=2
* sum(2)=2+3=5
* sum(3)=2+3+5=10
* sum(4)=2+3+5+7=17
* ...
* sum(7)=2+3+5+7+11+13+17=58
*/
System.out.println(Test.sum(7));
}
//²úÉúÖÊÊýnµÄºóÒ»¸öÖÊÊý£¬Èçn=2,return 3
public static int nextNum(int n){
n++;
for(int i=2;i<n;i++){
if(n%i==0){
//²»ÊÇÖÊÊý
n++;
continue;
}
}
return n;
}
//ÇóºÍ·½·¨
public static int sum(int count){
if(count <0) return 0;
int sum = 2;
int zn=2;
for(int i=0;i<count-1;i++){
zn=Test.nextNum(zn);
System.out.println(zn);
sum += zn;
}
return sum;
}
}
Ïà¹ØÎĵµ£º
ÔÚ´«ÖǵÄÕâ¶Îʱ¼äÿÌìµÄÇéÐÎÏë¶¼ÏëµÃµ½£¬Á½µãÒ»Ïߣ¬µ«ÊÇÿÌì¶¼¸Ð¾õµ½ºÜ³äʵ£¬Ñ§Ï°£¬²»Í£µÄѧϰ¡£Ô½ÊDz»Í£µÄѧϰ£¬Ô½ÊǸоõ×Ô¼ºµÄÁ¦Á¿ÊÇÄÇôµÄ΢±¡£¬×Ô¼ºµÄÄÜÁ¦ÊÇÄÇôµÄС£¬JAVAÕæÊDz©´ó¾«Éî¡£ÀÏʦ˵½ÐÎÒÃDz»Òªµ£ÐÄ£¬¿ÉÊÇÎÒ²»µ£ÐÄÒ²²»¿ÉÄÜŶ£¬±Ï¾¹ÔÚͬÀàѧУ±ÏÒµµÄ£¬Ò²ÐíÎÒÃÇ¿ÉÒÔËãµÃÉÏÊǺܲ»´íµÄ£¬µ«ÊǺÍÎÒÃÇ̨ͬ¾º¼¼µÄÈË ......
8. µ±ÏµÍ³´¦ÀíÍê³Éºó£¬±¨±í±»ÏÔʾ³öÀ´¡£ÕâÊÇÒ»·ÝÉÌÆ·ÏúÊÛ±¨¸æ£¬ÏÔʾµÄÊÇÿÀàÉÌÆ·µÄ¼¾¶ÈÏúÊÛ¶îÒÔ¼°ÀÛ¼ÆÇé¿ö¡£½ÓÏÂÀ´£¬ÎÒÃdz¢ÊÔÓà Java
´´½¨Ò»¸öʼþÏìÓ¦´¦ÀíÀ࣬°Ñÿ¼¾¶ÈÏúÊÛ¶îÔÚ10ÍòÃÀÔªÒÔÉϵÄÊý¾ÝÓúìÉ«±êʾ³öÀ´¡£
´´½¨ Java Àà
°´ÕÕÈçϲ½Ö裬Óà Java ´´½¨°ÙÁ鱨±í£¨BIRT£©µÄʼþÏìÓ¦´¦Àí³ÌÐò¡£
......
1£¬intÓëbytes ת»»
intת»»³Ébytes
public
static
final
byte
[]
int2bytes
(
int
value
)
{
return
new
byte
[]
{
(
byte
)(
value
>>>
24
),
(
byte
)(
value
>>>
16
),
......
ÉÏÒ»´Î£¬ÎÒÃÇÍê³ÉÁ˽çÃæµÄ×éÖ¯¡£½ÓÏÂÀ´ÎÒÃÇÍê³ÉÒµÎñÂß¼¡£
1£©ÈçºÎÍê³ÉÖÜΧÏàÁڵİ´Å¥±äÉ«¡£
·ÖÎö£ºÒòΪÎÒÃÇ×öÁËÒ»¸ö5*5µÄÊý×é¡£²¢ÇÒÊÂÏÈÎÒÃǸøÃ¿¸ö×Ô¶¨ÒåµÄbutton¼ÓÁËxºÍy×ø±ê
¾ÍÊÇΪÁ˸ü·½±ãµÄ¸øÏàÁڵİ´Å¥±äÉ«¡£
µ±ÎÒÃǵã»÷(2£¬2)°´Å¥Ê±£¬ÖÜΧµÄ 4¸ö°´Å¥»á±ä»¯¡£
µ±È»Ê×ÏÈÎÒÃÇÓ¦¸ÃÏȸøÃ¿¸ö°´Å¥Ôö¼Ó¼àÌýÆ÷¡£Î ......
//´ÓÊý×éaÖÐɾ³ýÊý×ébÖдæÔÚµÄÔªËØ
String stra[] = {"g","b","c","h","k"};//ÔʼÊý×é
String strb[] = {"g","k"}; //ÒÆ³ýµÄÔªËØ
ArrayList list = new ArrayList();
//·½·¨Ò»
for(int i=0;i<stra.length;i++){
int n=0;
......