程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> HDOJ 題目4372 Count the Buildings(斯特林第一類數)

HDOJ 題目4372 Count the Buildings(斯特林第一類數)

編輯:C++入門知識

HDOJ 題目4372 Count the Buildings(斯特林第一類數)


Count the Buildings

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 738 Accepted Submission(s): 246



Problem Description There are N buildings standing in a straight line in the City, numbered from 1 to N. The heights of all the buildings are distinct and between 1 and N. You can see F buildings when you standing in front of the first building and looking forward, and B buildings when you are behind the last building and looking backward. A building can be seen if the building is higher than any building between you and it.
Now, given N, F, B, your task is to figure out how many ways all the buildings can be.
Input First line of the input is a single integer T (T<=100000), indicating there are T test cases followed.
Next T lines, each line consists of three integer N, F, B, (0 Output For each case, you should output the number of ways mod 1000000007(1e9+7).
Sample Input
2
3 2 2
3 2 1

Sample Output
2
1

Source 2012 Multi-University Training Contest 8
Recommend zhuyuanchen520 | We have carefully selected several similar problems for you: 4059 1098 1130 1131 1134 ac代碼
#include
#include
#define mod 1000000007
__int64 s[2010][2010],c[2010][2010],n,f,b;
void fun()
{
    int i,j;
    for(i=0;i<2010;i++)
    {
        c[i][0]=1;
        c[i][i]=1;
        s[i][0]=0;
        s[i][i]=1;
        for(j=0;j

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved