ã½ã¼ã¹ã³ã¼ãããªãã®ã«ãã½ã¼ã¹ã³ã¼ããå ¬éããã¦ãã¾ã!?
ããããéçºããã¸ã§ã¯ãã«å¯¾ããå®è¡ãã¡ã¤ã«ã«ã¯å¸¸ã«ã½ã¼ã¹ã³ã¼ããæ·»ä»ãããã¨ãã¨ããæ¡ä»¶ã課ããããã¨ããããããªãã¦é常èãªï¼ãã¨ãã¨ã¾ã©ãããã¸ã§ã¯ããªã¼ãã¼ãé¢ä¿è ã¯å¤ãã§ãããããªã¼ãã³ã½ã¼ã¹ã»ããã¸ã§ã¯ããªãã°ã¨ããããå®è¡ãã¡ã¤ã«ã®ä¸ã«ã¯ã¦ã¼ã¶ã¼ã®å人æ å ±ãå¦çããã³ã¼ããIDããã¹ã¯ã¼ãã¨ããã»ã³ã·ãã£ããªæ å ±ãæ±ãé¨åãæéãããã¦éçºããé«åº¦ãªåæãã¸ãã¯ãªã©ããããã½ã¼ã¹ã³ã¼ããé示ãããã°ä¿è·ãã¹ããã®ãä¿è·ã§ããªããªã£ã¦ãã¾ãããããããã¾ãã
ãä¼æ¥ã®ã³ã³ãã©ã¤ã¢ã³ã¹ãæ å ±ã»ãã¥ãªãã£ãéè¦ãããæ¨ä»ã§ã¯ãã½ã¼ã¹ã³ã¼ããå³éã«ç®¡çããåæã«æã¡åºããããéã«å人ã³ã³ãã¥ã¼ã¿ã¼ã®æã¡è¾¼ã¿ãå³ããå¶éãã¦ããä¼æ¥ãå°ãªãããã¾ãããç¹ã«ããã±ã¼ã¸ã½ãããã²ã¼ã ã½ããã«ãããã½ã¼ã¹ã³ã¼ãä¿è·ã®éè¦æ§ã¯è¨ãã¾ã§ããªãã§ãããã
ããããã.NET Frameworkã§éçºãããã¢ããªã±ã¼ã·ã§ã³ã¯ãã½ã¼ã¹ã³ã¼ãããªãã¦ããã¢ããªã±ã¼ã·ã§ã³ï¼å®è¡ãã¡ã¤ã«ï¼ããå ã®ã½ã¼ã¹ã³ã¼ãã¸ã容æã«éã³ã³ãã¤ã«ã§ãã¦ãã¾ãã¾ãã.NETã§ã¯ããã¢ã»ã³ããªãã¨å¼ã°ããæ§æåä½ããç¸äºä½ç¨ã§ããæ å ±ï¼ã¡ã¿ãã¼ã¿ï¼ãä¿æãã¦ãããããããã使ã£ã¦å é¨ã解æãããããªã£ã¦ããã®ã§ã ï¼æ³¨1ï¼ã
ãJavaã§ãåæ§ã§ããéã«ãC/C++è¨èªç¨ã®éã³ã³ãã¤ã«ãã¼ã«ã¯åå¨ãã¾ãããããã»ã©é«ç²¾åº¦ã§ã¯ããã¾ããã
éã³ã³ãã¤ã©æè¡ã®é²æ©ã¨è å¨
ãç¾å¨ãéã³ã³ãã¤ã©ã®æè¡ãã©ã®ããã«é²åãã¦ãããããç°¡åãªããã°ã©ã ã使ã£ã¦ç¤ºãã¾ãããªã¹ã1ã¯ãç°¡åãªã³ã³ã½ã¼ã«ã¢ããªã±ã¼ã·ã§ã³ãæç²ãããã®ã§ãã
static void CalcRank() { Array.Clear(count, 0, MAXNUM); // å¾ç¹å¥é åãã¯ãªã¢ for (int i = 0; i < MAXNUM; i++) // å ¨å¡ã«å¯¾ãå¾ç¹å¥ã®é åãã«ã¦ã³ãã¢ãã count[score[i]]++; int j = 0; // æé«ç¹ã®äººã®é ä½ï¼0åºæºï¼ for (int i = MAXSCORE; i >= 0; i--) // æé«ç¹ããé ã«é ä½ã¥ã { ptsrank[i] = j; j += count[i]; } for (int i = 0; i < MAXNUM; i++) rank[i] = ptsrank[score[i]]; // å¾ç¹å¥é ä½ãå ¨å¡ã«å²ãå½ã¦ã }
ãããã§ã¯ã.NET Reflectorã¨ãã.NETç¨ã®éã³ã³ãã¤ã©ãã¼ã«ã使ãã¾ã ãå³1ã¯ããªã¹ã1ã§çæãããå®è¡ãã¡ã¤ã«ãéã³ã³ãã¤ã«ãã¦ããæ§åã§ããããã§ã¯ãããã°æ å ±ãæããªãReleaseãã«ãçãæ±ã£ã¦ãã¾ããããããã°æ å ±ãæ®ã£ã¦ããã°å®æ°ã·ã³ãã«ããã¼ã«ã«å¤æ°ã®ååãå«ãã¦ãããã«æ£ç¢ºãªéã³ã³ãã¤ã«ãªã¹ããå¾ããã¾ããããããéã³ã³ãã¤ã«æã«ã¯è¨èªããC#ãããVisual Basicããªã©å¥½ããªè¨èªãé¸æã§ãã¾ãã
ãã³ã³ãã¤ã©ã¯ãé¸ãã è¨èªã®ææ³ã«æ²¿ã£ã¦ããã°ã©ã ã³ã¼ããã.NETç¨ã®ã³ã¼ãï¼ILãä¸éè¨èªï¼ãçæãã¾ãããã®å¤æã®ä»æ¹ãåæããçæãããã³ã¼ãããå ã®ããã°ã©ã ãæ¨æ¸¬ããã®ãéã³ã³ãã¤ã©ã®ä»çµã¿ã§ããã³ã¼ãçæã®ãã¿ã¼ã³åæã¯çå®ã«é²æ©ãã¦ãããLINQãã©ã ãå¼ã使ãææ°çã®.NET Frameworkã«ã対å¿ãã¦ãã¾ããã¾ãã.NET Frameworkããããã°ã©ãã³ã°ã®æè»æ§ãé«ããããã«ãã¢ã»ã³ããªä¸ã«ãã¾ãã¾ãªã¡ã¿ãã¼ã¿ãåãè¾¼ãã§ãããã¨ã精度ã®é«ã解æã«å½¹ç«ã£ã¦ãã¾ãã
ãC#ãVisual Basicã®ãããªè¨èªã¬ãã«ã«å¾©å ããã¦ãã¾ãã¨ãããã°ã©ã ã®ç解ã¯å®¹æã§ããã¨ãã«ãã³ã¡ã³ãããªãã¦ãåãããããããã°ã©ã ããæ¸ãã¦ããå ´åã¯ãã½ã¼ã¹ã³ã¼ããå ¬éããã¦ããã®ã¨ä¼¼ããããªç¶æ ã ã¨è¨ãã¾ããã¤ã¾ããéçºããã¸ã§ã¯ãã®ä¸ã§ãã½ã¼ã¹ã³ã¼ãã®æã¡åºããå³ããå¶éãã¦ãã¦ããç¥ç財ç£ã®ä¿è·ãæ å ±ã»ãã¥ãªãã£ã®é¢ã§ãªã¹ã¯ã«ããããã¦ãã¾ãã®ã§ãã
ã.NET Reflectorã®åä½çã¯ç¡æã§ããéçºä¸ã®ããã¸ã§ã¯ããããã°ãæå ã®å®è¡ãã¡ã¤ã«ã§éã³ã³ãã¤ã«ã試ãã¦ã¿ã¦ãããã§ããããããããæ³å以ä¸ã«æ£ç¢ºãªã½ã¼ã¹ã³ã¼ããå¾ãããã¯ãã§ãã