|
Hidden Sister (Excel) |
difficulty level: C; operating time limit: 10 00MS, operating space limit: 256000KB; code length limit: 2000000B |
question description |
Today Czy again found three sister, with a collection of hobbies he wants to find three The place hid the girls, and abstracted an empty space into a table of row C of R, Czy to select 3 cells. However, the following two conditions are met: (1) Any two cells are not in the same row. (2) Any two cells are not in the same column. The selection lattice exists for a cost, while this cost is between three lattice 22 and Manhattan distance (e.g. (x1,y1) and (x,y2) of Manhattan Distance for |x1-x2|+|y1-y2|). What the dog wants to know is how many programs it spends between mint and maxt. Answer modulo 1000000007. The so-called two different scenarios are: As long as the selected cell has a different, it is considered a different scenario. |
input |
one line, 4 integers, R, C, MinT, Maxt. 3≤r,c≤4000, 1≤mint≤maxt≤20000. for 30% of data, 3 ≤ r, c ≤ 70. |
output |
An integer that represents the result of a different selection scheme number modulo 1000000007. |
Input Example |
6 19 4 18776  /td> |
Output Example |
116280  |
|
#include <cstdio>
#include <iostream>
#define MOD 1000000007
#define LL Long Long
using namespace Std;
LL ans;
int n,m,mx,mn;
int main ()
{
scanf ("%d%d%d%d", &n,&m,&mn,&mx);
for (int i=3;i<=n;i++)
for (int j=3;j<=m;j++)
{
int w=2* (I+J-2);
if (w<=mx&&w>=mn) ans+= (LL) (n-i+1) * (m-j+1) * (i-2) * (j-2)%mod;
}
printf ("%lld\n", (ans*6)%mod);
}
Tibetan Sister (Excel) (c + +)