日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內最全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 閱讀次數:3280次



題目描寫:

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


生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 国产伦精品一区二区三区免 | 毛片一| 99精品国产高清一区二区麻豆 | 久久996热在线播放 日韩精品第一区 | 欧美精品一区二区久久 | 免费黄色在线网站 | 精品国产乱码久久久久久蜜臀 | 国产激情精品一区二区三区 | 黄色av一区 | 日本一区二区免费看 | 国产三区四区 | 紧缚捆绑精品一区二区 | 国产精品久久久免费视频 | 国产精品免费电影 | 国产精品二区三区 | 成年人视频免费在线观看 | 5999在线视频免费观看 | 日本免费三区 | 久久aⅴ乱码一区二区三区 蜜桃永久免费 | 欧美国产日韩视频 | 国产精品视频一区二区三区不卡 | 男女av| 日本 欧美 在线 | 九九久久精品 | 黄色片网站在线观看 | 岛国片在线免费观看 | 精品国产31久久久久久 | 国产精品永久在线 | 黄色小视频在线观看 | wwwyoujizz日本| 日韩av电影免费看 | 国产一区二区三区网站 | 福利视频在线导航 | 国产激情在线 | 在线观看日韩精品 | 亚洲第十页 | 色av吧| 精品一区二区三区四区 | 国产精品久久久久久久9999 | 久久成人av| 最新高清无码专区 |