锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久一本综合,99久久精品国产一区二区蜜芽,亚洲第一极品精品无码久久http://www.shnenglu.com/MiYu/category/14423.html ______________鐧界櫧銇眿zh-cnSun, 15 Aug 2010 16:54:20 GMTSun, 15 Aug 2010 16:54:20 GMT60HDOJ 1205 HDU 1205 鍚冪硸鏋?ACM 1205 IN HDU http://www.shnenglu.com/MiYu/archive/2010/08/12/123151.htmlMiYuMiYuThu, 12 Aug 2010 02:41:00 GMThttp://www.shnenglu.com/MiYu/archive/2010/08/12/123151.htmlhttp://www.shnenglu.com/MiYu/comments/123151.htmlhttp://www.shnenglu.com/MiYu/archive/2010/08/12/123151.html#Feedback0http://www.shnenglu.com/MiYu/comments/commentRss/123151.htmlhttp://www.shnenglu.com/MiYu/services/trackbacks/123151.htmlMiYu鍘熷垱, 杞笘璇鋒敞鏄?: 杞澆鑷?______________鐧界櫧銇眿

棰樼洰鍦板潃:
         http://acm.hdu.edu.cn/showproblem.php?pid=1205
棰樼洰鎻忚堪:
鍚冪硸鏋?br>
Time Limit: 
6000/3000 MS (Java/Others)    Memory Limit: 2000/1000 K (Java/Others)
Total Submission(s): 
4426    Accepted Submission(s): 1310


Problem Description
HOHO錛岀粓浜庝粠Speakless鎵嬩笂璧㈣蛋浜嗘墍鏈夌殑緋栨灉錛屾槸Gardon鍚冪硸鏋滄椂鏈変釜鐗規畩鐨勭櫀濂斤紝灝辨槸涓嶅枩嬈㈠皢涓鏍風殑緋栨灉鏀懼湪涓璧峰悆錛屽枩嬈㈠厛鍚冧竴縐嶏紝涓嬩竴嬈″悆鍙︿竴縐嶏紝榪欐牱錛涘彲鏄疓ardon涓嶇煡閬撴槸鍚﹀瓨鍦ㄤ竴縐嶅悆緋栨灉鐨勯『搴忎嬌寰椾粬鑳芥妸鎵鏈夌硸鏋滈兘鍚冨畬錛熻浣犲啓涓▼搴忓府蹇欒綆椾竴涓嬨?br> 

Input
絎竴琛屾湁涓涓暣鏁癟錛屾帴涓嬫潵T緇勬暟鎹紝姣忕粍鏁版嵁鍗?琛岋紝絎竴琛屾槸涓涓暣鏁癗錛?/span>0<N<=1000000)錛岀浜岃鏄疦涓暟錛岃〃紺篘縐嶇硸鏋滅殑鏁扮洰Mi(0<Mi<=1000000)銆?br> 

Output
瀵逛簬姣忕粍鏁版嵁錛岃緭鍑轟竴琛岋紝鍖呭惈涓涓?/span>"Yes"鎴栬?/span>"No"銆?br> 

Sample Input
2
3
4 1 1
5
5 4 3 2 1
 

Sample Output
No
Yes

棰樼洰鍒嗘瀽 :
         鍏堝悆涓涓渶澶氱殑, 鍐嶅悆涓涓叾浠栫殑,鍙鏈澶氱殑婊¤凍 :  sum - max + 1 >= max , 閭d箞灝卞彲浠ュ悆瀹?

浠g爜濡備笅:
main(T,N,num,max){long long sum;scanf("%d",&T);while(T--){scanf("%d",&N);sum=0,max=0;while(N--){scanf("%d",&num);max=num>max?num:max;sum+=num;}sum-=max-1;puts(sum>=max?"Yes":"No");}}



MiYu 2010-08-12 10:41 鍙戣〃璇勮
]]>
HDOJ HDU 1235 緇熻鍚屾垚緇╁鐢熶漢鏁?ACM 1235 IN HDU http://www.shnenglu.com/MiYu/archive/2010/08/09/122731.htmlMiYuMiYuMon, 09 Aug 2010 01:22:00 GMThttp://www.shnenglu.com/MiYu/archive/2010/08/09/122731.htmlhttp://www.shnenglu.com/MiYu/comments/122731.htmlhttp://www.shnenglu.com/MiYu/archive/2010/08/09/122731.html#Feedback0http://www.shnenglu.com/MiYu/comments/commentRss/122731.htmlhttp://www.shnenglu.com/MiYu/services/trackbacks/122731.htmlMiYu鍘熷垱, 杞笘璇鋒敞鏄?: 杞澆鑷?______________鐧界櫧銇眿

棰樼洰鍦板潃:
         http://acm.hdu.edu.cn/showproblem.php?pid=1235

寰堣皝鐨勯, 鐩存帴 hash 灝卞彲浠ヤ簡.
浠g爜濡備笅 :
#include <iostream>
#include 
<map>
using namespace std;
int main ()
{
    
int N;
    
while ( scanf ( "%d",&N ) , N )
    {
            map 
< int ,int > mp;
            
int num;
            
for ( int i = 0; i != N; ++ i )
            {
                  scanf ( 
"%d",&num );
                  mp[num] 
++
            }
            scanf ( 
"%d",&num );
            cout 
<< mp[num] << endl;
    } 
    
//getchar();
    return 0
}
main (N,num)
{
int scr[101],i;while(scanf("%d",&N),N){
memset ( scr , 
0sizeof ( scr ) );
for (i = 0; i != N; ++ i )
{scanf ( 
"%d",&num );scr[num] ++;}
scanf (
"%d",&num);
printf (
"%d\n",scr[num]);} 
}
 

MiYu 2010-08-09 09:22 鍙戣〃璇勮
]]>
HDOJ HDU 1201 18宀佺敓鏃?ACM 1201 IN HDU http://www.shnenglu.com/MiYu/archive/2010/08/08/122706.htmlMiYuMiYuSun, 08 Aug 2010 14:24:00 GMThttp://www.shnenglu.com/MiYu/archive/2010/08/08/122706.htmlhttp://www.shnenglu.com/MiYu/comments/122706.htmlhttp://www.shnenglu.com/MiYu/archive/2010/08/08/122706.html#Feedback0http://www.shnenglu.com/MiYu/comments/commentRss/122706.htmlhttp://www.shnenglu.com/MiYu/services/trackbacks/122706.htmlMiYu鍘熷垱, 杞笘璇鋒敞鏄?: 杞澆鑷?______________鐧界櫧銇眿

棰樼洰鍦板潃:
         http://acm.hdu.edu.cn/showproblem.php?pid=1201
棰樼洰鎻忚堪:
Problem Description
Gardon鐨?8宀佺敓鏃ュ氨瑕佸埌浜嗭紝浠栧綋鐒跺緢寮蹇冿紝鍙槸浠栫獊鐒舵兂鍒頒竴涓棶棰橈紝鏄笉鏄瘡涓漢浠庡嚭鐢熷紑濮嬶紝鍒拌揪18宀佺敓鏃ユ椂鎵緇忚繃鐨勫ぉ鏁伴兘鏄竴鏍風殑鍛紵浼間箮騫朵笉鍏ㄩ兘鏄繖鏍鳳紝鎵浠ヤ粬鎯寵浣犲府蹇欒綆椾竴涓嬩粬鍜屼粬鐨勫嚑涓湅鍙嬩粠鍑虹敓鍒拌揪18宀佺敓鏃ユ墍緇忚繃鐨勬誨ぉ鏁幫紝璁╀粬濂芥潵姣旇緝涓涓嬨?br> 

Input
涓涓暟T錛屽悗闈琛屾瘡琛屾湁涓涓棩鏈燂紝鏍煎紡鏄痀YYY
-MM-DD銆傚鎴戠殑鐢熸棩鏄?988-03-07銆?br> 

Output
T琛岋紝姣忚涓涓暟錛岃〃紺烘浜轟粠鍑虹敓鍒?8宀佺敓鏃ユ墍緇忚繃鐨勫ぉ鏁般傚鏋滆繖涓漢娌℃湁18宀佺敓鏃ワ紝灝辮緭鍑?/span>-1銆?br> 

Sample Input
1
1988-03-07
 

Sample Output
6574

姘撮, 娉ㄦ剰鏈夋病鏈?8宀佸拰 鐟炲勾鐨勫垽鏂氨濂戒簡

浠g爜濡備笅 ( 鍙傜収濂嬫枟鍝?) :
#include <iostream>
#include 
<cmath>
using namespace std;
bool isLeap ( int n )
{
        
return !( n % ( n % 100 ? 4 : 400 ) ); 
}
 
int main ()
{
       
int T;
    scanf ( 
"%d"&T );
       
while ( T -- )
       {
            
int year, month, day;
               scanf ( 
"%d-%d-%d"&year, &month, &day );
                  
if ( month == 2 && day == 29 )
                  {
                          cout 
<< -1 << endl;
                          
continue;
                  }
                  
int run = 0;
                  
if ( month >= 3 )
                  {
                          
for ( int i = 1; i <= 18++ i )
                             {
                       
if ( isLeap ( year + i ) )
                       {
                            run 
++;
                       }
                 }
                  }
                  
else
                  {
                          
for ( int i = 0; i < 18++ i )
                             {
                       
if ( isLeap ( year + i ) )
                       {
                                           run 
++;
                       }
                 }
                  }
                  cout 
<< 365 * 18 + run << endl;
       }
       
return 0;
}


MiYu 2010-08-08 22:24 鍙戣〃璇勮
]]>
HDOJ HDU 1202 The calculation of GPA ACM 202 IN HDU http://www.shnenglu.com/MiYu/archive/2010/08/08/122691.htmlMiYuMiYuSun, 08 Aug 2010 12:27:00 GMThttp://www.shnenglu.com/MiYu/archive/2010/08/08/122691.htmlhttp://www.shnenglu.com/MiYu/comments/122691.htmlhttp://www.shnenglu.com/MiYu/archive/2010/08/08/122691.html#Feedback0http://www.shnenglu.com/MiYu/comments/commentRss/122691.htmlhttp://www.shnenglu.com/MiYu/services/trackbacks/122691.htmlMiYu鍘熷垱, 杞笘璇鋒敞鏄?: 杞澆鑷?______________鐧界櫧銇眿

棰樼洰鍦板潃:
         http://acm.hdu.edu.cn/showproblem.php?pid=1202
棰樼洰鎻忚堪:
Problem Description
姣忓鏈熺殑鏈熸湯錛屽ぇ瀹墮兘浼氬繖浜庤綆楄嚜宸辯殑騫沖潎鎴愮嘩錛岃繖涓垚緇╁浜庤瘎濂栧閲戞槸鐩存帴鏈夊叧鐨勩傚浗澶栧ぇ瀛﹂兘鏄綆桮PA(grade point average) 鍙堢ОGPR(grade point ratio)錛屽嵆鎴愮嘩鐐規暟涓庡鍒嗙殑鍔犳潈騫沖潎鍊兼潵浠h〃涓涓鐢熺殑鎴愮嘩鐨勩傞偅涔堝浣曟潵璁$畻GPA鍛紵 

涓鑸ぇ瀛﹂噰鐢ㄤ箣璁″垎娉?nbsp;

A90 
- 100 4 鐐?nbsp;
B80 
- 89 3 鐐?nbsp;
C70 
- 79 2 鐐?nbsp;
D60 
- 69 1 鐐?nbsp;
E0 
- 59 0 鐐?nbsp;

渚嬪錛氭煇浣嶅鐢熶慨涔犱笁闂ㄨ錛屽叾璇劇洰銆佸鍒嗗強鎴愮嘩鍒嗗埆涓猴細 
鑻辨枃錛氫笁瀛﹀垎銆?/span>92 鍒嗭紱鍖栧錛氫簲瀛﹀垎銆?/span>80 鍒嗭紱鏁板錛氫簩瀛﹀垎銆?0鍒嗭紝鍒橤PA鐨勭畻娉曞涓嬶細 

縐戠洰 瀛﹀垎 鍒嗘暟 鐐規暟 鍒嗘暟×鐐規暟 
鑻辨枃  
3    92    4     12
鍖栧  
5    80    3     15
鏁板  
2    60    1      2
鍚堣  
10   29 
29/10=2.9 
2.9鍗充負鏌愮敓鐨凣PA 
涓嬮潰鏈夎浣犲啓涓涓敤浜庤綆桮PA鐨勭▼搴忋?br> 

Input
鍖呭惈澶氱粍鏁版嵁錛屾瘡緇勬暟鎹殑絎竴琛屾湁涓涓暟N錛屾帴涓嬫潵N琛屾瘡琛岃〃紺轟竴闂ㄦ垚緇┿傛瘡琛屾湁涓や釜瀹炲瀷鐨勬暟 s,p錛宻琛ㄧず榪欓棬璇劇殑瀛﹀垎,p琛ㄧず璇ュ鐢熺殑鎴愮嘩錛堢櫨鍒嗗埗錛夈傚鏋減
=-1鍒欒鏄庤瀛︾敓榪欓棬璇劇己鑰冿紝鏄笉搴旇璁$畻鍦ㄥ唴鐨勩?br> 

Output
瀵規瘡緇勬暟鎹緭鍑轟竴琛岋紝琛ㄧず璇ュ鐢熺殑GPA錛屼繚鐣欎袱浣嶅皬鏁般傚鏋淕PA涓嶅瓨鍦紝杈撳嚭
-1銆?br> 

Sample Input
3
3 92
5 80
2 60
 

Sample Output
2.90


姣棤鐤戦棶, 榪欐槸涓涓按棰? 浣嗘槸鎴戞偛鍓х殑榪樻槸WA 浜?嬈?, 娉ㄦ剰鍒伴鐩殑杈撳嚭瑕佹眰閲屾湁涓鍙ヨ瘽 : 濡傛灉 GPA涓嶅瓨鍦?杈撳嚭 -1 .  

浠涔堟椂鍊欎笉瀛樺湪?  0 !    鍙鎶婅繖涓? 澶勭悊濂藉氨琛屼簡. YM .

浠g爜濡備笅 :
//MiYu鍘熷垱, 杞笘璇鋒敞鏄?: 杞澆鑷?______________鐧界櫧銇眿

#include 
<iostream>
#include 
<iomanip>
using namespace std;
int hash[11= { 00000012344 };
int main ()
{
    
int T;
    
while ( cin >> T )
    {
            
double total = 0 , pnt = 0, scr = 0 , mlt = 0;
            
while ( T -- )
            {
                    cin 
>> pnt >> scr;
                    
if ( scr == -1 )
                    {
                         
continue
                    }
                    total 
+= pnt;
                    mlt 
+= pnt * hash[ (int)scr / 10 ]; 
            } 
            
if ( total < 1e-5 )
            {
                 cout 
<< -1 << endl;
                 
continue;
            }
            cout 
<< setprecision (2<< setiosflags ( ios::fixed ) << mlt * 1.0 / total << endl;
    }
    
return 0



MiYu 2010-08-08 20:27 鍙戣〃璇勮
]]>
HDOJ HDU 2061 Treasure the new start, freshmen! ACM 2061 IN HDU http://www.shnenglu.com/MiYu/archive/2010/08/07/122580.htmlMiYuMiYuSat, 07 Aug 2010 14:31:00 GMThttp://www.shnenglu.com/MiYu/archive/2010/08/07/122580.htmlhttp://www.shnenglu.com/MiYu/comments/122580.htmlhttp://www.shnenglu.com/MiYu/archive/2010/08/07/122580.html#Feedback1http://www.shnenglu.com/MiYu/comments/commentRss/122580.htmlhttp://www.shnenglu.com/MiYu/services/trackbacks/122580.htmlMiYu鍘熷垱, 杞笘璇鋒敞鏄?: 杞澆鑷?______________鐧界櫧銇眿

棰樼洰鍦板潃:
         http://acm.hdu.edu.cn/showproblem.php?pid=2061
棰樼洰鎻忚堪:
Problem Description
background:
new semester comes , and the HDU also meets its 50th birthday. No matter what's your major, the only thing I want to tell you is:"Treasure the college life and seize the time." Most people thought that the college life should be colorful, less presure.But in actual, the college life is also busy and rough. If you want to master the knowledge learned from the book, a great deal of leisure time should be spend on individual study and practise, especially on the latter one. I think the every one of you should take the learning attitude just as you have in senior school.
"
No pain, No Gain", HDU also has scholarship, who can win it? That's mainly rely on the GPA(grade-point average) of the student had got. Now, I gonna tell you the rule, and your task is to program to caculate the GPA.
If there are K(K > 0) courses, the i-th course has the credit Ci, your score Si, then the result GPA is
GPA 
= (C1 * S1 + C2 * S2 +……+Ci * Si……) / (C1 + C2 + ……+ Ci……) (1 <= i <= K, Ci != 0)
If there 
is a 0 <= Si < 60, The GPA is always not existed.
 

Input
The first number N indicate that there are N test cases(N 
<= 50). In each case, there is a number K (the total courses number), then K lines followed, each line would obey the format: Course-Name (Length <= 30) , Credits(<= 10), Score(<= 100).
Notice: There 
is no blank in the Course Name. All the Inputs are legal
 

Output
Output the GPA of each 
case as discribed above, if the GPA is not existed, ouput:"Sorry!"else just output the GPA value which is rounded to the 2 digits after the decimal point. There is a blank line between two test cases. 
 

Sample Input
2
3
Algorithm 
3 97
DataStruct 
3 90
softwareProject 
4 85
2
Database 
4 59
English 
4 81
 

Sample Output
90.10

Sorry
!


棰樼洰鍒嗘瀽:

         榪欏彧鏄竴閬撶畝鍗曠殑鏁板艱綆楅, 鍞竴鐨勯毦搴﹀湪璇婚.  鐩存帴浣跨敤棰樼洰緇欏嚭鐨勫叕寮忓氨鍙互浜? 褰撶劧濡傛灉鎸傜鐨勮瘽,瑕佽緭鍑?"Sorry!"

涓嬮潰鏄鐩殑澶ц嚧緲昏瘧:
鑳屾櫙:
鏂扮殑瀛︽湡鍗沖皢鍒版潵錛屼篃姝i㈡澀宸炵數瀛愮鎶澶у50鍛ㄥ勾鏍″簡銆傛棤璁轟綘鐨勪笓涓氭槸浠涔堬紝鎴戝敮涓瑕佸憡璇夐偅涔堢殑鏄細“鐝嶆儨澶у鐨勭敓媧伙紝鍒╃敤濂芥椂闂淬?#8221; 寰堝浜鴻涓哄ぇ瀛︾殑鐢熸椿鍥炴槸涓板瘜澶氶噰銆備絾浜嬪疄鏄紝澶у鐢熸椿涔熷悓鏍峰繖紕屻傚鏋滀綘瑕佹帉鎻′功涓婄殑鐭ヨ瘑錛屼綘鐨勭┖闂叉椂闂村繀欏昏姳鍦ㄨ嚜瀛﹀拰瀹炶返涓婏紝灝ゅ叾鏄疄璺點傛垜璁や負錛屼綔涓轟竴浣嶅ぇ瀛︾敓錛屾墍鏈変漢閮藉繀欏葷姝h嚜宸辯殑瀛︿範鎬佸害銆?br>“娌℃湁涓嶅姵鑰岃幏鐨勪簨鎯?#8221;錛屾澀鐢典篃璁劇珛浜嗗瀛﹂噾錛屼綘鑳藉緱鍒板悧錛熷畠涓昏渚濇嵁鏄鐢熻幏寰楃殑GPA(嫻嬭瘎騫沖潎鍒?銆傜幇鍦紝鎴戝皢鍛婅瘔浣犲畠鐨勮鍒欙紝浣犵殑浠誨姟灝辨槸緙栫▼璁$畻GPA銆?br>鍋囧鏈塊闂ㄨ紼嬶紝絎琲闂ㄨ鐨勫鍒嗕負Ci錛屼綘鐨勬垚緇╀負涓篠i錛屽垯GPA涓猴細
GPA 
= (C1 * S1 + C2 * S2 +……+Ci * Si……) / (C1 + C2 + ……+ Ci……) (1 <= i <= K, Ci != 0)
濡傛灉鏈変竴闂ㄨ紼嬫垚緇╁湪0鍒?0涔嬮棿錛屽垯GPA灝嗕笉瀛樺湪銆?/span>

浠g爜濡備笅:
MiYu鍘熷垱, 杞笘璇鋒敞鏄?: 杞澆鑷?______________鐧界櫧銇眿

#include 
<iostream>
int main ()
{
    
int f, T, N;
    
double s, c;
    
double up, down; 
    scanf( 
"%d"&T );
    
while ( T -- )
    {
            scanf ( 
"%d"&N );
            up 
= down = f = 0;
            
while ( N -- )
            {
                  scanf ( 
"%*s%lf%lf"&c, &s );
                  
if ( f )
                  {
                       
continue;
                  }
                  
if ( s < 60 && s >= 0 )
                  {
                       f 
= 1;
                  }
                  up 
+= s * c;
                  down 
+= c;
            }
            printf( f 
? "Sorry!\n" : "%.2f\n", up / down );
            
if ( T ) putchar ( '\n' );
    }
    
return 0;
}


MiYu 2010-08-07 22:31 鍙戣〃璇勮
]]>
HDOJ HDU 2088 Box of Bricks ACM 2088 IN HDU http://www.shnenglu.com/MiYu/archive/2010/08/07/122550.htmlMiYuMiYuSat, 07 Aug 2010 10:08:00 GMThttp://www.shnenglu.com/MiYu/archive/2010/08/07/122550.htmlhttp://www.shnenglu.com/MiYu/comments/122550.htmlhttp://www.shnenglu.com/MiYu/archive/2010/08/07/122550.html#Feedback0http://www.shnenglu.com/MiYu/comments/commentRss/122550.htmlhttp://www.shnenglu.com/MiYu/services/trackbacks/122550.htmlMiYu鍘熷垱, 杞笘璇鋒敞鏄?: 杞澆鑷?______________鐧界櫧銇眿

棰樼洰鍦板潃:
         http://acm.hdu.edu.cn/showproblem.php?pid=2088
棰樼洰鎻忚堪:
Problem Description
Little Bob likes playing with his box of bricks. He puts the bricks one upon another and builds stacks of different height. “Look, I
've built a wall!”, he tells his older sister Alice. “Nah, you should make all stacks the same height. Then you would have a real wall.”, she retorts. After a little consideration, Bob sees that she is right. So he sets out to rearrange the bricks, one by one, such that all stacks are the same height afterwards. But since Bob is lazy he wants to do this with the minimum number of bricks moved. Can you help?

 

Input
The input consists of several data sets. Each 
set begins with a line containing the number n of stacks Bob has built. The next line contains n numbers, the heights hi of the n stacks. You may assume 1≤n≤50 and 1≤hi≤100.

The total number of bricks will be divisible by the number of stacks. Thus, it 
is always possible to rearrange the bricks such that all stacks have the same height.

The input 
is terminated by a set starting with n = 0. This set should not be processed.
 

Output
For each 
set, print the minimum number of bricks that have to be moved in order to make all the stacks the same height.
Output a blank line between each 
set.
 

Sample Input
6
5 2 4 1 7 5
0
 

Sample Output
5

棰樼洰鍒嗘瀽:
         鍝堝搱 ,鍙堟槸涓涓按棰?  璨屼技榪欐鏃墮棿涓鐩村湪姘撮.  鍒氬紑濮嬬湅鐨勬椂鍊欒繕浠ヤ負鏄?DP ,  鐪嬫噦棰樼洰鍚庣煡閬撹繖鍙槸涓涓畝鍗曠殑灝忓鏁板棰?鍛靛懙.   濡傛灉姹傜Щ鍔ㄦ鏁拌繕澶嶆潅鐐? 浣嗛鐩姹傜殑鏄?鏈灝忔惉鍔ㄦ鏁? 閭d箞鍙姹傚嚭騫沖潎鍊? 澶т簬騫沖潎鍊肩殑澧欏氨鏄縐誨姩鐨勫 ,绱姞灝卞彲浠ヤ簡.

浠g爜濡備笅:
MiYu鍘熷垱, 杞笘璇鋒敞鏄?: 杞澆鑷?______________鐧界櫧銇眿

#include 
<iostream>
#include 
<string>
using namespace std;
int main ()
{
    
int N;
    
int f = 0;
    
while ( cin >> N, N )
    {
            
if ( f )
            {
                 cout 
<< endl; 
            }
            f 
= 1;
            
int num[N+1];
            num[N] 
= 0;
            
for ( int i = 0; i != N; ++ i ) 
            {
                  cin 
>> num[i];
                  num[N] 
+= num[i]; 
            }
            num[N] 
/= N;
            
int nCount = 0;
            
for ( int i = 0; i != N; ++ i )
            {
                  
if ( num[i] > num[N] )
                  {
                       nCount 
+= num[i] - num[N]; 
                  } 
            } 
            cout 
<< nCount << endl;
    }
    
return 0;
}


MiYu 2010-08-07 18:08 鍙戣〃璇勮
]]>
HDOJ HDU 2093 鑰冭瘯鎺掑悕 ACM 2093 IN HDU http://www.shnenglu.com/MiYu/archive/2010/08/07/122545.htmlMiYuMiYuSat, 07 Aug 2010 09:33:00 GMThttp://www.shnenglu.com/MiYu/archive/2010/08/07/122545.htmlhttp://www.shnenglu.com/MiYu/comments/122545.htmlhttp://www.shnenglu.com/MiYu/archive/2010/08/07/122545.html#Feedback2http://www.shnenglu.com/MiYu/comments/commentRss/122545.htmlhttp://www.shnenglu.com/MiYu/services/trackbacks/122545.htmlMiYu鍘熷垱, 杞笘璇鋒敞鏄?: 杞澆鑷?______________鐧界櫧銇眿

棰樼洰鍦板潃:
         http://acm.hdu.edu.cn/showproblem.php?pid=2093
棰樼洰鎻忚堪:
Problem Description
C
++緙栫▼鑰冭瘯浣跨敤鐨勫疄鏃舵彁浜ょ郴緇燂紝鍏鋒湁鍗蟲椂鑾峰緱鎴愮嘩鎺掑悕鐨勭壒鐐廣傚畠鐨勫姛鑳芥槸鎬庝箞瀹炵幇鐨勫憿錛?br>鎴戜滑鍋氬ソ浜嗛鐩殑瑙g瓟錛屾彁浜や箣鍚庯紝瑕佷箞“AC”錛岃涔堥敊璇紝涓嶇鎬庢牱閿欐硶錛屾繪槸緇欎綘璁頒笂涓絎旓紝琛ㄦ槑浣犳浘緇忔湁榪囦竴嬈¢敊璇彁浜わ紝鍥犺屽綋浣犱竴鏃︽彁浜よ棰?#8220;AC”鍚庯紝灝辮涓庝綘綆椾竴綆楀笎浜嗭紝鎬誨叡璇ラ閿欒鎻愪氦浜嗗嚑鍥炪傝櫧鐒朵綘鍦ㄩ鏁頒笂錛屽ぇ姝ュ湴璺冧笂浜嗕竴涓彴闃訛紝浣嗘槸鍦ㄨ楁椂涓婅鎽婁笂浣犲叡鑺卞幓鐨勬椂闂淬傜壒鍒槸錛屾浘緇忔湁榪囩殑閿欒鎻愪氦錛屾瘡嬈¢兘瑕佹憡涓婁竴瀹氱殑鍗曚綅鏃墮棿鍒嗐傝繖鏍蜂竴鏉ワ紝浣犲湪鍋氬嚭鐨勯鏁頒笂錛屽彲鑳介鍏堝埆浜哄緢澶氾紝浣嗘槸錛屽湪鍋氬嚭鍚屾牱棰樻暟鐨勪漢緹や腑錛屼綘鍙兘浼氬湪鑰楁椂涓婂浜庢帓鍚嶇殑鍔e娍銆?br>渚嬪錛氭煇嬈¤冭瘯涓鍏?棰橈紙A錛孊錛孋錛孌錛孍錛孎錛孏錛孒錛夛紝姣忎釜浜哄仛鐨勯閮藉湪瀵瑰簲鐨勯鍙蜂笅鏈変釜鏁伴噺鏍囪錛岃礋鏁拌〃紺鴻瀛︾敓鍦ㄨ棰樹笂鏈夎繃鐨勯敊璇彁浜ゆ鏁幫紝浣嗗埌鐜板湪榪樻病鏈堿C錛屾鏁拌〃紺篈C鎵鑰楃殑鏃墮棿錛屽鏋滄鏁癮璺熶笂涓瀵規嫭鍙鳳紝閲岄潰鏈変釜鏁存暟b錛岄偅灝辮〃紺鴻瀛︾敓鎻愪氦璇ラAC浜嗭紝鑰楀幓浜嗘椂闂碼錛屽悓鏃訛紝鏇劇粡閿欒鎻愪氦浜哹嬈★紝鍥犳瀵逛簬涓嬭堪杈撳叆鏁版嵁錛?br>


鑻ユ瘡嬈¢敊璇彁浜ょ殑緗氬垎涓?0鍒嗭紝鍒欏叾鎺掑悕浠庨珮鍒頒綆搴旇鏄繖鏍風殑錛?br>Josephus 
5 376
John 
4 284
Alice 
4 352
Smith 
3 167
Bob 
2 325
Bush 
0 0
 

Input
杈撳叆鏁版嵁鐨勭涓琛屾槸鑰冭瘯棰樻暟n錛?/span>1≤n≤12錛変互鍙婂崟浣嶇綒鍒嗘暟m錛?/span>10≤m≤20錛夛紝姣忚鏁版嵁鎻忚堪涓涓鐢熺殑鐢ㄦ埛鍚嶏紙涓嶅浜?0涓瓧絎︾殑瀛椾覆錛変互鍙婂鎵鏈塶閬撻鐨勭瓟棰樼幇鐘訛紝鍏舵弿榪伴噰鐢ㄩ棶棰樻弿榪頒腑鐨勬暟閲忔爣璁扮殑鏍煎紡錛岃涓婇潰鐨勮〃鏍鹼紝鎻愪氦嬈℃暟鎬繪槸灝忎簬100錛孉C鎵鑰楁椂闂存繪槸灝忎簬1000銆?br>
 

Output
灝嗚繖浜涘鐢熺殑鑰冭瘯鐜扮姸錛岃緭鍑轟竴涓疄鏃舵帓鍚嶃傚疄鏃舵帓鍚嶆樉鐒跺厛鎸堿C棰樻暟鐨勫灝戞帓錛屽鐨勫湪鍓嶏紝鍐嶆寜鏃墮棿鍒嗙殑澶氬皯鎺掞紝灝戠殑鍦ㄥ墠錛屽鏋滃噾宸у墠涓よ呴兘鐩哥瓑錛屽垯鎸夊悕瀛楃殑瀛楀吀搴忔帓錛屽皬鐨勫湪鍓嶃傛瘡涓鐢熷崰涓琛岋紝杈撳嚭鍚嶅瓧錛?0涓瓧絎﹀錛夛紝鍋氬嚭鐨勯鏁幫紙2涓瓧絎﹀錛屽彸瀵歸綈錛夊拰鏃墮棿鍒嗭紙4涓瓧絎﹀錛屽彸瀵歸綈錛夈傚悕瀛椼侀鏁板拰鏃墮棿鍒嗙浉浜掍箣闂存湁涓涓┖鏍箋?br> 

Sample Input
8 20
Smith      
-1    -16    8    0    0    120    39    0
John      
116    -2    11    0    0    82    55(1)    0
Josephus  
72(3)    126    10    -3    0    47    21(2)    -2
Bush      
0    -1    -8    0    0    0    0    0
Alice      
-2    67(2)    13    -1    0    133    79(1)    -1
Bob      
0    0    57(5)    0    0    168    -7    0
 

Sample Output
Josephus    
5  376
John        
4  284
Alice       
4  352
Smith       
3  167
Bob         
2  325
Bush        
0    0

棰樼洰鍒嗘瀽 :  
         綰補鑰冮獙緙栫▼鑳藉姏鐨勯,  灝變氦緇欒嚜宸遍槦閲岀殑浠g爜鐗涗漢瑙e喅鍚?,  涓昏鏄嬌鐢?sscanf ()  鐢ㄤ簬鍒ゆ柇 鏈夋病鏈夋嫭鍙?

浠g爜濡備笅:
#include <cstdio>
#include 
<cstdlib>
#include 
<cstring>
#define    MAX 1000

typedef 
struct
{
    
char    name[11];
    
int    sum;
    
int    total;
}credit;

int cmp(const void *a, const void *b)
{
    
if ((*(credit *)a).total != (*(credit *)b).total)
        
return (*(credit *)a).total - (*(credit *)b).total;
    
else if ((*(credit *)b).sum != (*(credit *)a).sum)
        
return (*(credit *)b).sum - (*(credit *)a).sum;
    
else
        
return strcmp((*(credit *)b).name, (*(credit *)a).name);
}

int main()
{
    
int    res, t, f;
    
int    i, n, m, j;
    
char    style[10];
    credit    c[MAX] 
= {0};
    scanf ( 
"%d%d"&n, &m );
    
for ( i = 0; scanf("%s", c[i].name) != EOF; i++ )
    {
          
for ( j = 0; j < n; j++ )
          {
                scanf ( 
"%s", style );
                res 
= sscanf(style, "%d(%d)"&t, &f );
                
if ( res == 2 )
                {
                    c[i].total
++;
                    c[i].sum 
+= t + f * m;
                }
                
else if (res == 1 && t > 0)
                {
                    c[i].total
++;
                    c[i].sum 
+= t;
                }
          }
    }

    qsort(c, i, 
sizeof(credit), cmp);
    
for ( i--; i >= 0; i-- )
    {
         printf(
"%-10s %2d %4d\n", c[i].name, c[i].total, c[i].sum);
    }
    
return 0;
}


MiYu 2010-08-07 17:33 鍙戣〃璇勮
]]>
HDOJ HDU 2086 A1 = ? ACM 2086 IN HDU http://www.shnenglu.com/MiYu/archive/2010/08/06/122461.htmlMiYuMiYuFri, 06 Aug 2010 08:52:00 GMThttp://www.shnenglu.com/MiYu/archive/2010/08/06/122461.htmlhttp://www.shnenglu.com/MiYu/comments/122461.htmlhttp://www.shnenglu.com/MiYu/archive/2010/08/06/122461.html#Feedback3http://www.shnenglu.com/MiYu/comments/commentRss/122461.htmlhttp://www.shnenglu.com/MiYu/services/trackbacks/122461.html______________鐧界櫧銇眿

棰樼洰鍦板潃:
         http://acm.hdu.edu.cn/showproblem.php?pid=2086
棰樼洰鎻忚堪:
Problem Description
鏈夊涓嬫柟紼嬶細Ai 
= (Ai-1 + Ai+1)/2 - Ci (i = 123. n).
鑻ョ粰鍑篈0, An
+1, 鍜?nbsp;C1, C2, ..Cn.
璇風紪紼嬭綆桝1 
= ?
 

Input
杈撳叆鍖呮嫭澶氫釜嫻嬭瘯瀹炰緥銆?br>瀵逛簬姣忎釜瀹炰緥錛岄鍏堟槸涓涓鏁存暟n,(n 
<= 3000); 鐒跺悗鏄?涓暟a0, an+1.鎺ヤ笅鏉ョ殑n琛屾瘡琛屾湁涓涓暟ci(i = 1.n);杈撳叆浠ユ枃浠剁粨鏉熺緇撴潫銆?br> 

Output
瀵逛簬姣忎釜嫻嬭瘯瀹炰緥錛岀敤涓琛岃緭鍑烘墍姹傚緱鐨刟1(淇濈暀2浣嶅皬鏁?.
 

Sample Input
1
50.00
25.00
10.00
2
50.00
25.00
10.00
20.00
 

Sample Output
27.50
15.00

榪欓亾棰樼殑鍏抽敭鍦ㄤ簬鍏紡鐨勬帹瀵? 鍏紡鎺ㄥ嚭鏉ラ棶棰樺氨瑙e喅浜?
Ai = (Ai-1 + Ai+1)/2 - Ci (i = 123. n). 鐢ˋ5鍋氱ず鑼冿紝灝辮兘鐚滄祴鍑哄叕寮忔潵銆傝瘉鏄庢柟娉曞彲浠ラ噰鐢ㄦ暟瀛﹀綊綰蟲硶銆傝繖閲岃瘉鏄庝粠鐣ャ?br>A5 = (A4 + A6) / 2 - C5
A4 
= (A3 + A5) / 2 - C4 = A3 / 2 + A4 / 4 + A6 / 4 - C5 / 2 - C4
=>A4 = 2A3/3 + A6/3 - 2C5/3 - 4C4/3

A3 
= (A2 + A4) / 2 - C3 = A2 / 2 + A3 / 3 + A6 / 6 - C5 / 3 - 2C4 / 3 - C3
=>A3 = 3A2/4 + A6/4 - C5/2 - C4 - 3C3/2

A2 
= (A1 + A3) / 2 - C2 = A1 / 2 + 3A2 / 8 + A6 / 8 - C5 / 4 - C4 / 2 - 3C3 / 4 - C2
=>A2 = 4A1/5 + A6/5 - 2C5/5 - 4C4/5 - 6C3/5 - 8C2/5

A1 
= (A0 + A2) / 2 - C1 = A0 / 2 + 2A1 / 5 + A6 / 10 - C5 / 5 - 2C4 / 5 - 3C3 / 5 - 4C2 / 5 - C1
=>A1 = 5A0/6 + A6/6 - C5/3 - 2C4/3 - C3 - 4C2/3 - 5C1/3

綆楀埌榪欓噷錛屾垜鎯充綘宸茬粡鎬葷粨鍑哄叕寮忎簡:
A1 
= (n * A0 + An+1 - 2 * Cn - 4 * Cn-1 -  - 2 * i * Cn-i+1 - 2 * n * C1) / (n + 1

浠g爜濡備笅 :
MiYu鍘熷垱, 杞笘璇鋒敞鏄?: 杞澆鑷?______________鐧界櫧銇眿

#include 
<stdio.h>
int main ()
{
    
int n, i;
    
double a0, an1, a1;
    
double c[3000];
    
while ( scanf ( "%d"&n) != EOF )
    {
        scanf ( 
"%lf%lf"&a0, &an1 );
        
for ( i = 0; i < n; i++ )
        {
             scanf(
"%lf", c + i);
        }
        a1 
= n * a0 + an1;
        
for ( i = 1; i <= n; i++ )
        {
              a1 
-= 2 * i * c[n - i];
        }
        printf ( 
"%.2f\n", a1 / ( n + 1 ) );
    }
    
return 0;
}


MiYu 2010-08-06 16:52 鍙戣〃璇勮
]]>
久久综合久久自在自线精品自| 97久久精品人人澡人人爽| 欧美亚洲另类久久综合| 久久久久99精品成人片试看| 国产成人精品综合久久久久| 久久国产AVJUST麻豆| 色婷婷久久久SWAG精品| 一本色综合久久| 日产精品久久久久久久| 99久久免费国产精品特黄| 久久91精品国产91| 亚洲中文字幕久久精品无码喷水 | 国产福利电影一区二区三区久久老子无码午夜伦不 | 亚洲人成无码www久久久| 波多野结衣久久一区二区| 久久婷婷五月综合成人D啪| 亚洲精品无码久久久久| 久久99国产精品尤物| 国产综合精品久久亚洲| 久久亚洲中文字幕精品一区四 | 久久综合久久综合久久综合| 久久久国产精品福利免费 | 久久一区二区三区免费| 国产精品久久久久久久久软件| 久久久www免费人成精品| 久久人人爽人人爽人人AV东京热| 麻豆一区二区99久久久久| 国产精品欧美久久久久无广告| 少妇久久久久久被弄到高潮| 中文字幕日本人妻久久久免费| a级成人毛片久久| 午夜视频久久久久一区 | 国产精品久久影院| 香蕉久久夜色精品国产2020| 精品久久久久香蕉网| 久久最新免费视频| 99久久99久久精品免费看蜜桃 | 99久久精品无码一区二区毛片| 人妻中文久久久久| 久久国产精品99久久久久久老狼| 狠狠色丁香久久婷婷综合_中|