http://codeforces.com/contest/1131

A

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 #define lson l,mid,rt<<1
 4 #define rson mid+1,r,rt<<1|1
 5 #define sqr(x) ((x)*(x))
 6 #define pb push_back
 7 #define eb emplace_back
 8 #define maxn 1000005
 9 #define rep(k,i,j) for(int k=i;k<j;k++)
10 typedef long long ll;
11 typedef unsigned long long ull;
12 
13 
14 int main(){
15     #ifndef ONLINE_JUDGE
16       //  freopen("input.txt","r",stdin);
17     #endif
18     std::ios::sync_with_stdio(false);
19     ll w1,h1,w2,h2;
20     cin>>w1>>h1>>w2>>h2;
21     ll tmp1=(w2+2)*(h2+2);//上面的
22     ll tmp2=(w1+2)*(h1+2);
23     ll tmp3=w1*h1+w2*h2;
24     ll ans=tmp1+tmp2-tmp3-2*(w2+2);
25     cout<<ans<<endl;
26 }
View Code

相关文章: