Codeforces Round #541 (Div. 2) A.Sea Battle
链接:https://codeforces.com/contest/1131/problem/A
题意:
给两个矩形,一个再上一个在下,求两个矩形合并的周围一圈的面积。
思路:
因为存在下面矩形宽度大于上面,所以先求下面矩形周围面积,再求上方矩形最下一行除外的面积。
代码:
#include <bits/stdc++.h> using namespace std; typedef long long LL; int main()
{
int w1, h1, w2, h2;
cin >> w1 >> h1 >> w2 >> h2;
cout << (w1 + 2) * (h1 + 2) - w1 * h1 - w2 + h2 * (w2 + 2) - (h2 - 1) * w2 << endl; return 0;
}
Codeforces Round #541 (Div. 2) A.Sea Battle的更多相关文章
- Codeforces Round #380 (Div. 2)/729D Sea Battle 思维题
Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the ...
- 构造 Codeforces Round #302 (Div. 2) B Sea and Islands
题目传送门 /* 题意:在n^n的海洋里是否有k块陆地 构造算法:按奇偶性来判断,k小于等于所有点数的一半,交叉输出L/S 输出完k个L后,之后全部输出S:) 5 10 的例子可以是这样的: LSLS ...
- Codeforces Round #541 (Div. 2)
Codeforces Round #541 (Div. 2) http://codeforces.com/contest/1131 A #include<bits/stdc++.h> us ...
- Codeforces 1131 A. Sea Battle-暴力 (Codeforces Round #541 (Div. 2))
A. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- Codeforces Round #541 (Div. 2) (A~F)
目录 Codeforces 1131 A.Sea Battle B.Draw! C.Birthday D.Gourmet choice(拓扑排序) E.String Multiplication(思路 ...
- Codeforces Round #Pi (Div. 2) D. One-Dimensional Battle Ships set乱搞
D. One-Dimensional Battle ShipsTime Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/con ...
- Codeforces Round #Pi (Div. 2) D. One-Dimensional Battle Ships set区间分解
D. One-Dimensional Battle ShipsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/co ...
- Codeforces Round #302 (Div. 2) B. Sea and Islands 构造
B. Sea and Islands Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/544/p ...
- Codeforces Round #541 (Div. 2)题解
不知道该更些什么 随便写点东西吧 https://codeforces.com/contest/1131 ABC 太热了不写了 D 把相等的用并查集缩在一起 如果$ x<y$则从$ x$往$y$ ...
随机推荐
- Spring Boot缓存源码分析
前言 项目里面要增加一个应用缓存,原本想着要怎么怎么来整合ehcache和springboot,做好准备配置这个配置那个,结果只需要做三件事: pom依赖 写好一个ehcache的配置文件 在boot ...
- [usaco2009nov]奶牛的图片
Farmer John希望给他的N(1<=N<=100,000)只奶牛拍照片,这样他就可以向他的朋友炫耀他的奶牛.这N只奶牛被标号为1..N.在照相的那一天,奶牛们排成了一排.其中第i个位 ...
- javascript学习第一天
从大学第一次接触到JavaScript,到现在一直是个软肋,之前也是学习过一遍,但是缺乏系统学习,基础不牢,那么今天开始从基础部分学起来,今天是第一天,每天至少要保证效率,也要保证学习质量. 恩,要按 ...
- loj#2340. 「WC2018」州区划分
FWT&&FMT板子 #include<cstdio> #include<iostream> #include<cstring> #include& ...
- VK Cup 2012 Qualification Round 1 E. Phone Talks —— DP
题目链接:http://codeforces.com/contest/158/problem/E E. Phone Talks time limit per test 3 seconds memory ...
- java反射技术实例
java反射技术实例1. [代码][Java]代码 package com.gufengxiachen.java.reflectiontest; public class Person {p ...
- laravel基础课程---1、laravel安装及基础介绍(laravel如何安装)
laravel基础课程---1.laravel安装及基础介绍(laravel如何安装) 一.总结 一句话总结: [修改composer镜像地址].[明确laravel的安装要求].[安装指定版本的la ...
- web安全字体
webfont解剖 Unicode字体可以包含数以千计字形 有四个字体格式: WOFF2, WOFF, EOT, TTF 一些字体格式需要使用GZIP压缩 一个web字体是字形的集合,且每个字形是一个 ...
- Subset Sums
链接 分析:dp[i][j]表示前i个数能够组成j的对数,可得dp[i][j]=dp[i-1][j]+dp[i-1][j-i],所以最后dp[n][sum/2]既是所求 /* PROB:subset ...
- 实现虚拟机VMware上linux与windows互相复制与粘贴
from:http://blog.csdn.net/u012243115/article/details/40454063 系统环境: win7系统,虚拟机VMwareWorkstation上运行的C ...