ToDo:
http://acm.pku.cn/JudgeOnline/problem?id=1981
¤Ê¤ó¤È¤Ê¤¯ÃÂÀ¸Ç¯ÌäÂ긫¤Æ¤ß¤¿¤±¤É³ä¤Ë³Ú¤·¤²¡£
(00:58)
b,l,s[99];main(m,n,i,w,x,y,z){ for(;;){ for(;n=getchar(n)-10;l+=8)s[n]++; if(l==24&&s['E']==s['N']==s['D']==1)break; z=85; x=55; for(;;){ s[m=n=99]=9999; w = 0; for(y=i=x;i<=z;i++){ if(s[i]) { if(!w)w=i; y = i; if(s[i]<s[m]){ if(s[i]<s[n]){m=n;n=i;} else m=i; } } } x=w; z=y; if(m==99)break; b+=(s[m]+=s[n]); s[n]=0; } printf("%d %d %.1f\n",l,b,1.*l/b); b=l=0; } }
ŬÅö¤ËC¤Ç½ñ¤¤¤Æ¤½¤Î¾ì¤·¤Î¤®¤Î¹â®²½¤·¤Æ¤âÄ̤é¤Ê¤«¤Ã¤¿¡£ ¤Ê¤ó¤«C¤ÇÄ̤äƤë¿Í¤¤¤ë¤ó¤À¤±¤É¤Ê¤¡¡£ ¤Þ¤¡C++¤ÎÊý¤¬Ã»¤¯¤Ê¤ê¤½¤¦¤Êµ¤¤¹¤é¤¹¤ë¡£
(02:53)
#include<cstdio> #include<set> int m,n,b,l,i,k[99];main(){ std::multiset<int>s; for(;;){ for(;n=getchar()-10;l+=8)k[n]++; if(l==24&&k['E']==k['N']==k['D']==1)break; for(i=55;i<=85;i++){if(k[i])s.insert(k[i]);} for(;s.size()>1;){ std::multiset<int>::iterator i=s.begin(); m = *i; s.erase(i++); n = *i; s.erase(i); b+=(m+=n); s.insert(m); } printf("%d %d %.1f\n",l,b,1.*l/b); b=l=0; } }
¤ª¤ä¤³¤ì¤Ç¤âTLE¡£¥À¥á¤¸¤ã¤ó¡ª
(03:09)
*m,*n,*i,s[99];main(b,l){ for(;m=n=memset(s,0,396);printf("%d %d %.1f\n",l,b,1.*l/b)){ for(l=0;b=getchar()-10;l+=8){ s[b]++; if(b-l==60)return; } for(b=0;m-s-1;){ b+=*m+=*n; *n=0; m=n=s+1; *m=99; for(i=s+86;*i-99;) *--i&&*i<*m?*i<*n?m=n,n=i:(m=i):0; } b=b?b:l/8; } }
250Byte¡£¤µ¤Ã¤µ¤È¥¢¥ë¥´¥ê¥º¥à¤¤¤¸¤ì¤È
(04:53)
Á° | 2006ǯ 6·î |
¼¡ | ||||
Æü | ·î | ²Ð | ¿å | ÌÚ | ¶â | ÅÚ |
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 |
Á´¤Æ¥ê¥ó¥¯¥Õ¥ê¡¼¤Ç¤¹¡£ ¥³¡¼¥ÉÊҤϼ«Í³¤Ë»ÈÍѤ·¤Æ¤¤¤¿¤À¤¤¤Æ¹½¤¤¤Þ¤»¤ó¡£ ¤½¤Î¾¤Î¤â¤Î¤ÏGPL°·¤¤¤Ç¤¢¤ì¤Ð¤¢¤é¤æ¤ë»ÈÍѤ˴ؤ·¤Æʸ¶ç¤Ï¸À¤¤¤Þ¤»¤ó¡£ ¤Ê¤Ë¤«¤¢¤ì¤Ð²¼µ¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ø¡£