Tibetan Sister (Excel) (c + +) Password: none

Source: Internet
Author: User

Favorites 
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 + +) Password: none

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.