多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > 綜合技術 > Facebook Hacker Cup 2015 Round 1 Winning at Sports (附帶測試數據)

Facebook Hacker Cup 2015 Round 1 Winning at Sports (附帶測試數據)

來源:程序員人生   發布時間:2015-02-27 08:36:00 閱讀次數:3274次



題目描寫:

Winning at Sports25 points
                                           
  •                  

In the game of Sports, the object is have more points than the other team after a certain amount of time has elapsed. Scores are denoted by two hyphen-separated integers. For example, scores may include 3⑵, 4⑴, or 10-0. The first number is how many points you've scored, and the second is the number of points scored by the opposing team. You're very good at Sports, and consequently you always win. However, you don't always achieve victory the same way every time.

The two most extreme kinds of victory are called stress-free and stressful. In a stress-free victory, you score the first point and from then on you always have more points than your opponent. In a stressful victory, you never have more points than your opponent until after their score is equal to their final score.

Given the final score of a game of Sports, how many ways could you arrange the order in which the points are scored such that you secure a stress-free or stressful win?

Input

Input begins with an integer T, the number of games you'll play. For each game, there is one line containing the final score of the game in the format described above.

Output

For the ith game, print a line containing "Case #i: " followed by two space-separated integers, the number of ways you can achieve a stress-free or stressful win, respectively. Since these numbers may be very large, output them modulo 1,000,000,007.

Constraints

1 ≤ T ≤ 100 

Since you always win, the first number in any final score will always be larger than the second. Both scores will be non-negative integers not exceeding 2000.

Explanation of Sample

In the third test case, you can get a stress-free win by scoring points 1, 2, and 4, or points 1, 2, and 3. You can get a stressful win by scoring points 2, 4, and 5, or points 3, 4, and 5.

Example input 

Example output ?         

5 2⑴ 3⑴ 3⑵ 10⑸ 1000⑸00
Case #1: 1 1 Case #2: 2 1 Case #3: 2 2 Case #4: 1001 42 Case #5: 70047606 591137401
                               






解題思路:

簡單DP,注意特殊情況,具體轉移進程見代碼.


題目代碼:

#include <set> #include <map> #include <queue> #include <math.h> #include <vector> #include <string> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <iostream> #include <cctype> #include <algorithm> #define eps 1e⑴0 #define pi acos(⑴.0) #define inf 107374182 #define inf64 1152921504606846976 #define lc l,m,tr<<1 #define rc m + 1,r,tr<<1|1 #define zero(a) fabs(a)<eps #define iabs(x) ((x) > 0 ? (x) : -(x)) #define clear1(A, X, SIZE) memset(A, X, sizeof(A[0]) * (min(SIZE,sizeof(A)))) #define clearall(A, X) memset(A, X, sizeof(A)) #define memcopy1(A , X, SIZE) memcpy(A , X ,sizeof(X[0])*(SIZE)) #define memcopyall(A, X) memcpy(A , X ,sizeof(X)) #define max( x, y ) ( ((x) > (y)) ? (x) : (y) ) #define min( x, y ) ( ((x) < (y)) ? (x) : (y) ) using namespace std; int map1[2005][2005]; int map2[2005][2005]; const int mod = 1000000007; int main() { //freopen("data.in","r",stdin); //freopen("data.txt","w",stdout); for(int i=1;i<=2000;i++) { map1[i][0]=1; map2[0][i]=1; } for(int i=1;i<=2000;i++) { for(int j=1;j<=2000;j++) { if(i!=j)map1[i][j]=map1[i][j⑴]; map1[i][j]+=map1[i⑴][j]; map2[i][j]=map2[i⑴][j]; if(i<j)map2[i][j]+=map2[i][j⑴]; map1[i][j]%=mod; map2[i][j]%=mod; } } int t,case1=1; while(scanf("%d",&t)!=EOF) { while(t--) { int a,b; scanf("%d-%d",&a,&b); printf("Case #%d: %d %d ",case1++,map1[a][b],max(1,map2[a][b])); } } return 0; }

題目終究測試數據:

鏈接: http://pan.baidu.com/s/1mgxFSNI 

密碼: suiw


生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 波多洁野衣一二区三区| 国产高清成人吃奶成免费视频 | 一级黄色淫片 | 久久网国产 | 国产欧美日韩一区 | yellow影院在线观看免费 | 色老头久久久久久久久久 | 欧美性猛片xxxxⅹ免费 | 国产一区二区三区欧美精品 | 最近免费中文字幕大全免费 | 毛片色 | 69视频在线 | 在线视频综合视频免费观看 | 欧美三级欧美做a爱 | 国产精品66福利在线观看 | 爱呦视频在线播放网址 | 五月激情六月丁香 | 91se在线看片国产免费观看 | 国产成人久久一区二区三区 | 中文字幕在线国产 | 精品福利一区二区三区免费视频 | 中文乱码精品一区二区三区 | 天天在线欧美精品免费看 | 女人18毛片a级毛片免费视频 | 99亚洲| 一本大道香蕉大无线视频 | 国产精品第一页爽爽影院 | 国产精品视频永久免费播放 | 国产成人精品免费久久久久 | 国产亚洲精品久久久久久久久激情 | 欧美在线视频不卡 | 国产中文欧美 | 欧美日韩成人在线视频 | 久草福利在线播放 | 国产高清在线精品一区二区三区 | 亚洲综合网站 | 欧美激情精品久久久久 | 亚洲欧美日韩中文字幕久久 | 国产美女福利视频福利 | 韩国jizz| www天堂在线观看 |