SOJ 4440 Rectangle(规律)

来源:互联网 发布:樱井知香喷泉gif 编辑:程序博客网 时间:2024/06/04 18:07
E - Rectangle
Time Limit:0MS     Memory Limit:0KB     64bit IO Format:%lld & %llu
Submit Status

Description

Rectangle

frog has a piece of paper divided into nn rows and mm columns. Today, she would like to draw a rectangle whose perimeter is not greater than kk.

There are 8 (out of 9) ways when n = m = 2, k = 6

There are 88 (out of 99) ways when n=m=2,k=6n=m=2,k=6

Find the number of ways of drawing.

Input

The input consists of multiple tests. For each test:

The first line contains 33 integer n,m,kn,m,k (1n,m5104,0k1091≤n,m≤5⋅104,0≤k≤109).

Output

For each test, write 11 integer which denotes the number of ways of drawing.

Sample Input

    2 2 6    1 1 0    50000 50000 1000000000

Sample Output

    8    0    1562562500625000000

/*头文件模板*/#include <map>#include <set>#include <cmath>#include <ctime>#include <queue>#include <vector>#include <cctype>#include <cstdio>#include <string>#include <cstring>#include <sstream>#include <cstdlib>#include <iomanip>#include <typeinfo>#include <iostream>#include <algorithm>#include <functional>using namespace std;#define pb push_back#define mp make_pair#define mem(a, x) memset(a, x, sizeof(a))#define copy(a, b) memcpy(a, b, sizeof(a))#define lson rt << 1, l, mid#define rson rt << 1|1, mid + 1, r#define FIN freopen("input.txt", "r", stdin)#define FOUT freopen("output.txt", "w", stdout)typedef long long LL;typedef pair<int, int > PII;typedef pair<int, string> PIS;typedef pair<LL, LL>PLL;typedef unsigned long long uLL;template<typename T>void print (T* p, T* q, string Gap = " ", bool flag = false) {int d = p < q ? 1 : -1;while (p != q) {if (flag) cout << Gap[0] << *p << Gap[1];else cout << *p;p += d;if (p != q && !flag) cout << Gap;}cout << endl;}template<typename T>void print (const T &a, string bes = "") {int len = bes.length();if (len >= 2) cout << bes[0] << a << bes[1] << endl;else cout << a << endl;}template<typename T>void debug (T* p, T* q, string Gap = " ", bool flag = false) {int d = p < q ? 1 : -1;cout << "Debug out : ";while (p != q) {if (flag) cout << Gap[0] << *p << Gap[1];else cout << *p;p += d;if (p != q && !flag) cout << Gap;}cout << endl;}template<typename T>void debug (const T &a, string bes = "") {int len = bes.length();cout << "Debug out : ";if (len >= 2) cout << bes[0] << a << bes[1] << endl;else cout << a << endl;}void IO_Init() {ios::sync_with_stdio (false);}LL LLabs (const LL a) {return a >= 0 ? a : -a;}const double PI = 3.1415926535898;const double eps = 1e-10;const int MAXM = 1e5 + 5;const int MAXN = 32000 + 5;const int INF = 0x3f3f3f3f;/*头文件模板*/int main() {#ifndef ONLINE_JUDGE//FIN;//FOUT;#endifIO_Init();    LL n, m, k;    while(~scanf("%lld%lld%lld", &n, &m, &k)){        k = min(k, 2 * (n + m));        k /= 2;        LL ans = 0;        for(int i = 1; i < k && i <= n; i ++){//enum h            LL t = min(k - i, m);            ans += (n - i + 1LL) * (2 * m - t + 1) * t / 2LL;//            printf("%lld\n", (2 * m - t + 1) * t / 2LL);        }        printf("%lld\n", ans);    }return 0;}


1 0