日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

CF--思维练习-- CodeForces - 215C - Crosses(思维题)

發布時間:2023/12/15 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CF--思维练习-- CodeForces - 215C - Crosses(思维题) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

ACM思維題訓練集合
There is a board with a grid consisting of n rows and m columns, the rows are numbered from 1 from top to bottom and the columns are numbered from 1 from left to right. In this grid we will denote the cell that lies on row number i and column number j as (i,?j).

A group of six numbers (a,?b,?c,?d,?x0,?y0), where 0?≤?a,?b,?c,?d, is a cross, and there is a set of cells that are assigned to it. Cell (x,?y) belongs to this set if at least one of two conditions are fulfilled:

|x0?-?x|?≤?a and |y0?-?y|?≤?b
|x0?-?x|?≤?c and |y0?-?y|?≤?d
The picture shows the cross (0,?1,?1,?0,?2,?3) on the grid 3?×?4.
Your task is to find the number of different groups of six numbers, (a,?b,?c,?d,?x0,?y0) that determine the crosses of an area equal to s, which are placed entirely on the grid. The cross is placed entirely on the grid, if any of its cells is in the range of the grid (that is for each cell (x,?y) of the cross 1?≤?x?≤?n; 1?≤?y?≤?m holds). The area of the cross is the number of cells it has.

Note that two crosses are considered distinct if the ordered groups of six numbers that denote them are distinct, even if these crosses coincide as sets of points.

Input
The input consists of a single line containing three integers n, m and s (1?≤?n,?m?≤?500, 1?≤?s?≤?n·m). The integers are separated by a space.

Output
Print a single integer — the number of distinct groups of six integers that denote crosses with area s and that are fully placed on the n?×?m grid.

Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.

Examples
Input
2 2 1
Output
4
Input
3 4 5
Output
4
Note
In the first sample the sought groups of six numbers are: (0,?0,?0,?0,?1,?1), (0,?0,?0,?0,?1,?2), (0,?0,?0,?0,?2,?1), (0,?0,?0,?0,?2,?2).

In the second sample the sought groups of six numbers are: (0,?1,?1,?0,?2,?2), (0,?1,?1,?0,?2,?3), (1,?0,?0,?1,?2,?2), (1,?0,?0,?1,?2,?3).

這個題我就貼個代碼吧,從10.00多做到了2.00多還沒讀懂這題要干什么,花了無數張圖,題解我都看了,我真的不知道這個題的意思,還做個屁呀。

#include <bits/stdc++.h> using namespace std; int n, m, s, r; long long f(int h, int w) { return (n - h + 1) * (m - w + 1); } long long ans; int main() {scanf("%d%d%d", &n, &m, &s);ans = 0;44for (int i = 1; i <= n; i += 2){ for (int j = 1; j <= m && (r = s - i * j) >= 0; j += 2){if (r == 0){ans += ((i + 1) * (j + 1) / 2 - 1) * f(i, j);}elsefor (int k = 1; k < j; k += 2)if (r % (2 * k) == 0 && i + r / k <= n)ans += 2 * f(i + r / k, j);}}cout << ans << endl;return 0; }

總結

以上是生活随笔為你收集整理的CF--思维练习-- CodeForces - 215C - Crosses(思维题)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。