ABC D求条,WA19个点
  • 板块学术版
  • 楼主Saint_ying_xtf
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/5/18 21:42
  • 上次更新2024/5/19 07:58:08
查看原帖
ABC D求条,WA19个点
1073995
Saint_ying_xtf楼主2024/5/18 21:42
// Author: Expert_Dream
// Copyright (c) 2024 Expert_Dream All rights reserved.
// Problem: D - AtCoder Wallpaper
// Contest: AtCoder - Panasonic Programming Contest 2024(AtCoder Beginner Contest 354)
// URL: https://atcoder.jp/contests/abc354/tasks/abc354_d
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Date: 2024-05-18 20:00:21

// #pragma GCC optimize(2,3,"Ofast","inline")
#include<bits/stdc++.h>
// #include <atcoder/all>
#define ll long long
#define i128 __int128
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fs first
#define sc second
#define x0 _x0_
#define y1 _y1_
#define endl '\n'
#define re register
#define pb push_back
#define vi vector<int>
#define pq priority_queue
#define mem(a,x) memset((a),(x),sizeof(a))
#define debug puts("AK IOI")
#define sz(s) (int)(s.size())
#define all(a) a.begin(),a.end()
#define rd(l,r) (myrand()%(r-l+1)+l)
#define print(x) {cout<<x<<endl;return;}
#define For(x,y,z) for(int x = y;x <= z;x++)
#define For_(x,y,z) for(int x = y;x >= z;x--)
#define between(x, flo, top) (flo <= x && x <= top)
// #define double long double
using namespace std;
// using namespace atcoder;
#define int long long
const int mod = 1e9+7;
//const int mod = 998244353;
mt19937 myrand(time(0));
const int inf = 0x3f3f3f3f,N = 2e5+5,M = 1e6+5,K = 3000+5;
const long long linf = 0x3f3f3f3f3f3f3f3f;
namespace FastIO {template <typename T = int>inline T read() {T s=0,w=1;char c=getchar();while(!isdigit(c)){if(c=='-')w=-1;c=getchar();}while(isdigit(c))s=(s<<1)+(s<<3)+(c^48),c=getchar();return s*w;}template <typename T>inline void read(T &s){s=0;int w=1;char c=getchar();while(!isdigit(c)){if(c=='-')w=-1;c=getchar();}while(isdigit(c))s=(s<<1)+(s<<3)+(c^48),c=getchar();s*=w;}template <typename T, typename... Args> inline void read(T &x, Args &...args) {read(x), read(args...);}template <typename T>inline void write(T x,char ch = '\n') {if(x<0)x=-x,putchar('-');static char stk[200];int top=0;do{stk[top++]=x%10+'0',x/=10;}while(x);while(top)putchar(stk[--top]);putchar(ch);return;}}
using namespace FastIO;
void solve(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	int x=c-a,y=d-b;
	if(x%4==0){
		cout<<y*x;return ;
	}else{
		int sum=y*(x-(x%4));
		For(i,c-(x%4)+1,c){
			int temp = y/2;
			if(i%2==0 && (y&1)) temp++;
			if(((i+1)/2)&1){
				temp = y*2-temp;
			}
			// cout<<i<<temp<<endl;
			sum+=temp;
		}cout<<sum<<endl;
	}
}signed main(){
	// ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
	int T=1;
	// read(T);
	For(_,1,T) solve();
	return 0;
}
2024/5/18 21:42
加载中...