JavaÃæÊÔÌ⣺è³ÔÀÏÊóÎÊÌâ
ÎÊÌ⣺ÏÖÓÐn¸öÀÏÊóΧ³ÉһԲȦ£¬ÓÐһֻè´ÓÈÎÒâλÖÿªÊ¼³ÔÀÏÊó£¬Ã¿´Î¶¼¸ôÒ»¸öÀÏÊó³Ô£¬Çë¸ø³ö×îºóÒ»¸öÀÏÊóµÄ±àºÅ£¿ÌâÄ¿ÒªÇóÊÇÈθøÀÏÊóÊýn£¬Êä³öè×îºó³ÔµÄÀÏÊóµÄ±àºÅ¡£
ÎҵĽⷨ£º
1.¼òµ¥µÄ·½·¨¾ÍÊÇÄ£ÄâÕâ¸ö¹ý³Ì¡£Ê¹ÓÃÒ»¸öÊý×é´ú±íÀÏÊóÊÇ·ñ±»³Ôµô£¬Ñ»·±éÀú¡£
2.¸Ä½øһϵķ½·¨£¬ÆäʵÕâ¸öÎÊÌâ¾ÍÊÇÒ»¸öm=2µÄԼɪ·ò»·ÎÊÌâ¡£
package com.easyProblem;
/*
* ÏÖÓÐn¸öÀÏÊóΧ³ÉһԲȦ£¬ÓÐһֻè´ÓÈÎÒâλÖÿªÊ¼³ÔÀÏÊó£¬Ã¿´Î¶¼¸ôÒ»¸öÀÏÊó³Ô£¬
* Çë¸ø³ö×îºóÒ»¸öÀÏÊóµÄ±àºÅ£¿ÌâÄ¿ÒªÇóÊÇÈθøÀÏÊóÊýn£¬Êä³öè×îºó³ÔµÄÀÏÊóµÄ±àºÅ
*/
public class CatEatMouseProblem {
private int[] m;
public static void main(String[] args) {
CatEatMouseProblem cm = new CatEatMouseProblem();
System.out.println("=======µÍЧµÄ·½·¨========");
long startTime =System.currentTimeMillis();
System.out.println(cm.easyWork(1111178));
long endTime=System.currentTimeMillis();
System.out.println("ºÄʱ£º" + (endTime-startTime));
System.out.println("=======¸Ä½øµÄ·½·¨========");
startTime =System.currentTimeMillis();
System.out.println(cm.betterWork(1111178));
endTime=System.currentTimeMillis();
System.out.println("ºÄʱ£º" + (endTime-startTime));
}
public int easyWork(int n){
m = new int[n];
int mouse = n;
int flag = 0;
m[0] = 1;
mouse--;
while(mouse>1){
flag = next(next(flag));
m[flag] = 1;
mouse--;
}
return next(flag)+1;
}
public int next(int start){
for(int i=start+1; i<start+m.length; i++){
int pos = i%(m.length);
if(m[pos]!=1) {
return pos;
}
}
return -1;
}
public int betterWork(int n){
int m = 2;
int s = 0;
for(int i=2; i<=n-1; i++) s=(s+m)%i;
return s+2;
}
}
=======µÍЧµÄ·½·¨========
125204
ºÄʱ£º953
=======¸Ä½øµÄ·½·¨========
125204
ºÄʱ£º31
Ïà¹ØÎĵµ£º
ÓÐÁ½ÖÖ·½Ê½£º¾²Ì¬²¿ÊðºÍ¶¯Ì¬²¿Êð¡£ÔÚÏÂÎÄÖÐ$CATALINA_HOMEÖ¸µÄÊÇTomcat¸ùĿ¼¡£
Ò»¡¢¾²Ì¬²¿Êð
¾²Ì¬²¿ÊðÖ¸µÄÊÇÎÒÃÇÔÚ·þÎñÆ÷Æô¶¯Ö®Ç°²¿Êð³ÌÐò£¬Ö»Óе±·þÎñÆ÷Æô¶¯Ö®ºó£¬WebÓ¦ÓóÌÐò²ÅÄÜ·ÃÎÊ¡£ÒÔÏÂ3Öз½Ê½¶¼¿ÉÒÔ²¿Êð£º
1¡¢½«PetWebĿ¼¿½±´µ½$CATALINA_HOME\webappsÏ£¬È»ºóÆô¶¯·þÎñÆ÷¾Í¿ÉÒÔÁË¡£ÕâÖÖ·½Ê½±È½Ï¼òµ¥£¬µ«ÊÇweb ......
Reflection ÊÇ Java ³ÌÐò¿ª·¢ÓïÑÔµÄÌØÕ÷Ö®Ò»£¬ËüÔÊÐíÔËÐÐÖÐµÄ Java ³ÌÐò¶Ô×ÔÉí½øÐмì²é£¬»òÕß˵“×ÔÉ󔣬²¢ÄÜÖ±½Ó²Ù×÷³ÌÐòµÄÄÚ²¿ÊôÐÔ¡£ÀýÈ磬ʹÓÃËüÄÜ»ñµÃ Java ÀàÖи÷³ÉÔ±µÄÃû³Æ²¢ÏÔʾ³öÀ´¡£
Java µÄÕâÒ»ÄÜÁ¦ÔÚʵ¼ÊÓ¦ÓÃÖÐÒ²ÐíÓõò»ÊǺܶ࣬µ«ÊÇÔÚÆäËüµÄ³ÌÐòÉè¼ÆÓïÑÔÖиù±¾¾Í²»´æÔÚÕâÒ»ÌØÐÔ¡£ÀýÈ磬Pasc ......
javaÖжÑÕ»(stack)ºÍ¶Ñ(heap)
Ò»¡¢¶ÑÕ»(stack)ºÍ¶Ñ(heap)£¿
£¨£±£©ÄÚ´æ·ÖÅäµÄ²ßÂÔ
¡¡¡¡°´ÕÕ±àÒëÔÀíµÄ¹Ûµã,³ÌÐòÔËÐÐʱµÄÄÚ´æ·ÖÅäÓÐÈýÖÖ²ßÂÔ,·Ö±ðÊǾ²Ì¬µÄ,ջʽµÄ,ºÍ¶ÑʽµÄ.
¡¡¾²Ì¬´æ´¢·ÖÅäÊÇÖ¸ÔÚ±àÒëʱ¾ÍÄÜÈ·¶¨Ã¿¸öÊý¾ÝÄ¿±êÔÚÔËÐÐʱ¿ÌµÄ´æ´¢¿Õ¼äÐèÇó,Òò¶øÔÚ±àÒëʱ¾Í¿ÉÒÔ¸øËûÃÇ·ÖÅä¹Ì¶¨µÄÄ ......
/*ͨ¹ýÊó±êÍÏ·ÅÎļþµ½Öƶ¨¿Ø¼þÖУ¬²¢ÅжÏÊÇ·ñΪÎļþ£¬Èç¹ûÊÇ£¬Ôòµ÷ÓÃÎļþ·¢ËÍ·½·¨ChatFrame.SendFile(finalpath);
*/
class TextDropTargetListener implements DropTargetListener
{
CODER Coder = new CODER();
CHAT_FRAME ChatFrame;
/**
Constructs a listener.
@param aTextArea the ......
»¨ÁË´ó°ëÌìµÄʱ¼äÖÕÓÚ½â¾öÁËÎÊÌ⣬ÏÂÃæ·ÖÏíÒ»ÏÂÎҵĹý³Ì£º
ÎÒµÄϵͳ°²×°µÄÊÇjdk6,netbeansºÍMycrosoft SqlServer 2005£¬javaÁ¬½ÓÊý¾Ý¿âÒ»°ãÒª·ÖÁù²¿×ß
1.×¢²áÇý¶¯
2.ÓÃÇý¶¯¹ÜÀíÀà´´½¨Á¬½Ó
3.´´½¨Óï¾ästatement·â×°sql½Å±¾Óï¾ä
4.Ö´ÐÐ
5.´¦Àí·µ»ØµÄ½á¹û
6.¹Ø±ÕÏà¹ØÁ¬½Ó
ÔÚÕâÀïÁ¬½ÓµÄÊÇSqlServer2005£¬ÊôÓÚµÚÈý·½Çý¶¯ ......