UvaOJ javaÊäÈë´úÂë
1. byte Èç¹ûûÓи³Öµ£¬ÄÇôjava»á×Ô¶¯½«Ëü¸³ÖµÎª £¨byte£©0;
static String ReadLn (int maxLg) // utility function to read from stdin
{
byte lin[] = new byte [maxLg];
int lg = 0, car = -1;
String line = "";
try
{
while (lg < maxLg)
{
car = System.in.read();
if ((car < 0) || (car == '\n')) break;
lin [lg++] += car;
}
}
catch (IOException e)
{
return (null);
}
if ((car < 0) && (lg == 0)) return (null); // eof
return (new String (lin, 0, lg));
}
public static void main (String args[]) // entry point from OS
{
Main myWork = new Main(); // create a dinamic instance
myWork.Begin(); // the true entry point
}
Ïà¹ØÎĵµ£º
Flyweight ¶¨Òå:
±ÜÃâ´óÁ¿ÓµÓÐÏàͬÄÚÈݵÄСÀàµÄ¿ªÏú(ÈçºÄ·ÑÄÚ´æ),ʹ´ó¼Ò¹²ÏíÒ»¸öÀà(ÔªÀà).
ÃæÏò¶ÔÏóÓïÑÔµÄÔÔò¾ÍÊÇÒ»Çж¼ÊǶÔÏó,µ«ÊÇÈç¹ûÕæÕýʹÓÃÆðÀ´,ÓÐʱ¶ÔÏóÊý¿ÉÄÜÏԵúÜÅÓ
´ó,±ÈÈç,×Ö´¦ÀíÈí¼þ,Èç¹ûÒÔÿ¸öÎÄ×Ö¶¼×÷Ϊһ¸ö¶ÔÏó,¼¸Ç§¸ö×Ö,¶ÔÏóÊý¾ÍÊǼ¸Ç§,ÎÞÒɺÄ
·ÑÄÚ´æ,ÄÇôÎÒÃÇ»¹ÊÇÒª"Çóͬ´æÒì",ÕÒ³öÕâЩ¶ÔÏóȺµÄ¹²Í¬ ......
//JavaÎļþÏÂÔØµÄ¼¸ÖÖ·½Ê½
public HttpServletResponse download(String path, HttpServletResponse response) {
try {
// pathÊ ......
ÓÉÓÚJDKÊǹú¼Ê°æµÄ£¬ÔÚ±àÒëµÄʱºò£¬Èç¹ûÎÒÃÇûÓÐÓÃ-encoding²ÎÊýÖ¸¶¨ÎÒÃǵÄJAVAÔ´³ÌÐòµÄ±àÂë¸ñʽ£¬Ôòjavac.exeÊ×ÏÈ»ñµÃÎÒÃDzÙ×÷ϵͳĬÈϲÉÓõıàÂë¸ñʽ£¬Ò²¼´ÔÚ±àÒëjava³ÌÐòʱ£¬ÈôÎÒÃDz»Ö¸¶¨Ô´³ÌÐòÎļþµÄ±àÂë¸ñʽ£¬JDKÊ×ÏÈ»ñµÃ²Ù×÷ϵͳµÄfile.encoding²ÎÊý(Ëü±£´æµÄ¾ÍÊDzÙ×÷ϵͳĬÈϵıàÂë¸ñʽ£¬ÈçWIN2k£¬ËüµÄֵΪGBK)£¬È»º ......
¹ØÓÚJavaÉú³É±³¾°Í¸Ã÷µÄpngͼƬ
×î½üÓõ½Java¶¯Ì¬Éú³É±³¾°Í¸Ã÷µÄͼƬ¹¦ÄÜ£¬´ÓgifºÍpngÖÐÑ¡ÔñÁËpng¸ñʽ£¬¸öÖÐÔµÓɾͲ»ËµÁË£¬ÓÚÊǶ¯ÊÖµ½ÍøÉÏËÑË÷ÓÐÓõĴúÂë¡£ÏÖ°ÑËÑË÷½á¹û×ܽáÈçÏ£º
1. Éú³ÉpngͼƬ
int width = 400;
int height = 300;
// ´´½¨BufferedImage¶ÔÏó
BufferedImage&nb ......