设为首页 加入收藏

TOP

UVA - 11806 - Cheerleaders (递推)
2015-07-20 17:20:22 来源: 作者: 【 】 浏览:3
Tags:UVA 11806 Cheerleaders 递推

UVA - 11806

Cheerleaders
Time Limit: 2000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu

Submit Status

Description

Download as PDF

C

Cheerleaders

In most professional sporting events, cheerleaders play a major role in entertaining the spectators. Their roles are substantial during breaks and prior to start of play. The world cup soccer is no exception. Usually the cheerleaders form a group and perform at the centre of the field. In addition to this group, some of them are placed outside the side line so they are closer to the spectators. The organizers would like to ensure that at least one cheerleader is located on each of the four sides. For this problem, we will model the playing ground as an M*N rectangular grid. The constraints for placing cheerleaders are described below:

§ There should be at least one cheerleader on each of the four sides. Note that, placing a cheerleader on a corner cell would cover two sides simultaneously.

§ There can be at most one cheerleader in a cell.

§ All the cheerleaders available must be assigned to a cell. That is, none of them can be left out.

\

The organizers would like to know, how many ways they can place the cheerleaders while maintaining the above constraints. Two placements are different, if there is at least one cell which contains a cheerleader in one of the placement but not in the other. <??http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+IDwvcD4KPHA+IDwvcD4KPHA+PHN0cm9uZz4gPC9zdHJvbmc+PC9wPgo8cD48c3Ryb25nPklucHV0PC9zdHJvbmc+PC9wPgo8cD48c3Ryb25nPiA8L3N0cm9uZz48L3A+CjxwPlRoZSBmaXJzdCBsaW5lIG9mIGlucHV0IGNvbnRhaW5zIGEgcG9zaXRpdmUgaW50ZWdlciA8c3Ryb25nPlQ8PTUwPC9zdHJvbmc+LCB3aGljaCBkZW5vdGVzIHRoZSBudW1iZXIgb2YgdGVzdCBjYXNlcy4gPHN0cm9uZz5UPC9zdHJvbmc+IGxpbmVzIHRoZW4gZm9sbG93IGVhY2ggZGVzY3JpYmluZyBvbmUgdGVzdCBjYXNlLiBFYWNoIGNhc2UgY29uc2lzdHMgb2YgdGhyZWUgbm9ubmVnYXRpdmUgaW50ZWdlcnMsIDxzdHJvbmc+Mjw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Beginning Algorithm Contests -- Training Guide (Rujia Liu) :: Chapter 2. Mathematics :: Counting :: Examples
Root :: Prominent Problemsetters :: Shamim Hafiz







AC代码:

#include 
  
   
#include 
   
     #include 
    
      using namespace std; const int MOD = 1000007; const int MAXK = 500; int C[MAXK+10][MAXK+10]; int main() { memset(C, 0, sizeof(C)); C[0][0] = 1; for(int i=0; i <= MAXK; i++) { C[i][0] = C[i][i] = 1; for(int j=1; j
     
      






】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇POJ 2251 三维广搜。 下一篇POJ2362 Square 搜索

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Redis on AWS:Elast (2025-12-27 04:19:30)
·在 Spring Boot 项目 (2025-12-27 04:19:27)
·使用华为开发者空间 (2025-12-27 04:19:24)
·Getting Started wit (2025-12-27 03:49:24)
·Ubuntu 上最好用的中 (2025-12-27 03:49:20)