题目链接:
    
     HDU 5727
    
    
   
题面:
    Necklace
   
   
    
     Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
     
     Total Submission(s): 1576    Accepted Submission(s): 499
     
    
   
    Problem Description
   
    SJX has 2*N magic gems.
    
    
    
     
      
       
        
         
N
          
         
        
        
        
       
      
      
     
    
of them have Yin energy inside while others have Yang energy. SJX wants to make a necklace with these magic gems for his beloved BHB. To avoid making the necklace too Yin or too Yang, he must place these magic gems Yin after Yang and Yang after Yin, which means two adjacent gems must have different kind of energy. But he finds that some gems with Yang energy will become somber adjacent with some of the Yin gems and impact the value of the neckless. After trying multiple times, he finds out M rules of the gems. He wants to have a most valuable neckless which means the somber gems must be as less as possible. So he wonders how many gems with Yang energy will become somber if he make the necklace in the best way.
N
of them have Yin energy inside while others have Yang energy. SJX wants to make a necklace with these magic gems for his beloved BHB. To avoid making the necklace too Yin or too Yang, he must place these magic gems Yin after Yang and Yang after Yin, which means two adjacent gems must have different kind of energy. But he finds that some gems with Yang energy will become somber adjacent with some of the Yin gems and impact the value of the neckless. After trying multiple times, he finds out M rules of the gems. He wants to have a most valuable neckless which means the somber gems must be as less as possible. So he wonders how many gems with Yang energy will become somber if he make the necklace in the best way.
    Input
   
    Multiple test cases.
    For each test case, the first line contains two integers
    
    
    
    
   
 
版权声明:本文为David_Jett原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
