CodeForces 581D Three Logos】的更多相关文章

爆搜. #include<cstdio> #include<string.h> #include<math.h> #include<queue> #include<algorithm> using namespace std; ],C[]; ],c[]; ]; int ans,f; bool check() { ;i<=;i++) { r[i]=R[i],c[i]=C[i]; ) swap(r[i],c[i]); } ]+r[]+r[]==…
BUPT 2017 Summer Training (for 16) #3A 题意 给你三个矩形,需要不重叠不留空地组成一个正方形.不存在输出-1,否则输出边长和这个正方形(A,B,C表示三个不同矩形). 题解 我的做法是直接枚举三个是否旋转90度,然后考虑两种组成,|||和=|,枚举3的排列. 其实可以先计算面积s,如果r=sqrt(s)不是整数则无解.然后找到一个较长边为r的矩阵先输出,再输出剩下两个. 代码 #include <cstdio> #include <algorithm…
先枚举两个矩形,每个矩形横着放或竖着放,把一边拼起来, 如果不是拼起来有缺口就尝试用第三个矩形去补. 如果没有缺口就横着竖着枚举一下第三个矩形和合并的矩形x或y拼接. #include<bits/stdc++.h> using namespace std; +; ][],ay[][]; char g[N][N]; void print_a(int len,int k) { printf("%d\n",len); int ch[] = {'C',k?'B':'A',k?'A'…
Three Logos CodeForces - 581D Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possibl…
D. Three Logos Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/problem/D Description Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is…
                                                  D. Three Logos Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's…
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters. There is…