题目大意:给定H,W,h,w四个数,求是否满足矩阵的全部数之和和正数,h行w列之和为负数 如果h和w恰好是H,W的约数,则肯定不存在 否则肯定存在 只需要把h,w内每个元素填的足够大,然后小矩形的最后一个元素为负,且保持整个小矩形为负即可(可用不等式证明) #include <iostream> #include <cstring> #include <cstdio> using namespace std; ][]; long long n, m, r, c; int…
链接: https://leetcode.com/problems/maximal-rectangle/ [描述] Given a 2D binary matrix filled with '0's and '1's, find the largest rectangle containing all ones and return its area. [中文描述] 给一个二维数组, 算出里面最大的全1矩形面积,比如: [ ['1','1','1','0'], ['1','1','1','1']…
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud System Administrator Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible…
1547: Rectangle Submit Page Summary Time Limit: 1 Sec Memory Limit: 256 Mb Submitted: 1198 Solved: 347 Description Now ,there are some rectangles. The area of these rectangles is 1* x or 2 * x ,and now you need find a big enough rec…
Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 18527 Accepted: 7490 Special Judge Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains…
B - Layer Cake Time Limit:6000MS Memory Limit:524288KB 64bit IO Format:%I64d & %I64u Submit Status Description Dasha decided to bake a big and tasty layer cake. In order to do that she went shopping and bought n rectangular cake layers. The l…
C. Money Transfers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n banks in the city where Vasya lives, they are located in a circle, such that any two banks are neighbouring if…
作为一位web开发者, 懂得怎样去规划一个页面的尺寸是很重要的. 现给定一个具体的矩形页面面积,你的任务是设计一个长度为 L 和宽度为 W 且满足以下要求的矩形的页面.要求: 1. 你设计的矩形页面必须等于给定的目标面积. 2. 宽度 W 不应大于长度 L,换言之,要求 L >= W . 3. 长度 L 和宽度 W 之间的差距应当尽可能小. 你需要按顺序输出你设计的页面的长度 L 和宽度 W. 示例: 输入: 4 输出: [2, 2] 解释: 目标面积是 4, 所有可能的构造方案有 [1,4],…
题意:给你一个长度为\(2*n-1\)的字符串\(s\),让你构造一个长度为\(n\)的字符串,使得构造的字符串中有相同位置的字符等于\(s[1..n],s[2..n+1],...,s[n,2n-1]\)中的位置上的字符. 题解:不难发现,\(s\)中的奇数位字符就是我们要的答案. 代码: int t; int n; char s[N]; int main() { //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); t=read(); wh…
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud Cyclic antimonotonic permutations Time Limit: 20000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description A permutation is a sequence of integers which contai…
http://codeforces.com/contest/725/problem/C Each English letter occurs at least once in s. 注意到题目有这样一句话,那么就是说S中只有一个重复的字母.一定要看到这句话,不然做不了. 然后就找到pos1和pos2分别代表那两个字母的位置,把他们中间的所有字母对折一下,放在最右边就可以了.因为这样才能用上同一个位置. 只有连续两个相同的字母才会impossible,同样是因为只有两个相同的字母. #includ…
D. Vanya and Treasure time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Vanya is in the palace that can be represented as a grid n × m. Each room contains a single chest, an the room locat…
E. Table Compression time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zipalgorithms and many others.…