Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- #include <map>
- #include <algorithm>
- using namespace std;
- typedef long long ll;
- int main()
- {
- int n, m, x, y;
- cin >> n >> m >> x >> y;
- int p1 = 0, p2 = 0;
- for(int i = 0; i <= x; i++) {
- for(int j = 0; j <= x; j++) {
- if(i + j <= y) {
- p1 = i;
- p2 = j;
- }
- }
- }
- int sum1 = 0;
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- if(i % 2 == 0 and j % 2 == 0) {
- sum1 += p1;
- }
- else if(i % 2 == 0 and j % 2 == 1) {
- sum1 += p2;
- }
- else if(i % 2 == 1 and j % 2 == 0) {
- sum1 += p2;
- }
- else {
- sum1 += p1;
- }
- }
- }
- int sum2 = 0;
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- if(i % 2 == 0 and j % 2 == 0) {
- sum2 += p2;
- }
- else if(i % 2 == 0 and j % 2 == 1) {
- sum2 += p1;
- }
- else if(i % 2 == 1 and j % 2 == 0) {
- sum2 += p1;
- }
- else {
- sum2 += p2;
- }
- }
- }
- cout << max(sum1, sum2) << endl;
- return 0;
- }
- // 2222222222
- // 22222222222
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement