Sea Battle】的更多相关文章

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…
D. Sea Battle time limit per test: 1 second memory limit per test :256 megabytes input: standard input output: standard output 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…
D. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output 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 con…
D. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output 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 con…
Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output 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 consis…
D. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output 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 con…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output 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 b consecu…
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 b consecutive cells. No cell can be part of two ships, however, the ships can touch each other. Galya doesn't know…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output 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 b consecu…
A. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In order to make the "Sea Battle" game more interesting, Boris decided to add a new ship type to it. The ship consists of…
题目链接:http://codeforces.com/contest/738/problem/D 题意:1*n的格子里有a条长为b的船.有一个人射了k发子弹都没打中船,现在问最少再打多少次一定能保证射到一搜. 统计出每一个子块中最多能多少条船,贪心地从左到右排列,记下船尾.假设有m条,那么除了m-a条船,剩下的位置一定能打中一条.就是打m-a+1个地方,随便打m-a+1个船尾就行了. #include <bits/stdc++.h> using namespace std; ; int n,…
题意: 有n个格子,a条船,每条船占b个格子.事先已经射击了k个格子,且这k次射击不会射到船上,求再射击几次可以射到某一条船的某一部分 思路: 观察样例可以发现,如果五个0,船的长度是3,那么这五个0中可能有 1 2 3 2 3 4 3 4 5 这三种位置都包含3这个id,所以,我们只需要射击到3这个位置就可以射击到船的某一部分 所以,我们只需要统计有多少个连续的0,就可以得到这连续的0中可能包含的船的条数,进而计算出最少的射击次数,也就是0的个数除以船的长度. 得到了总的设计次数,将其减去船的…
抽屉原理. 先统计最多有$sum$个船可以放,假设打了$sum-a$枪都没打中$a$个船中的任意一个,那么再打$1$枪必中. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #include…
链接: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 >&g…
题目链接 http://codeforces.com/contest/729/problem/D 题意:给你一个1*n的区域有a艘船,每艘船宽b,已经开了k枪都没打到,问你最少再开几枪至少能打到一艘船. 想清楚了挺简单的,只要找到所有船可能放的地方然后存下再找任意sum-a+1个位置即可. #include <iostream> #include <cstring> #include <algorithm> #include <vector> using n…
http://codeforces.com/contest/738/problem/D https://www.cnblogs.com/flipped/p/6086615.html   原 题意:海战棋游戏,长度为n的01串,1代表炸过且没有船的位置,0代表没有炸过的位置.有a个船,长度都是b,求打到一艘船至少还需要多少炸弹,并输出炸的位置. 分析:每连续的b个0就要炸一次,不然不知道有没有是不是刚好一艘船在这b个位置上面.贪心可知炸这b个的最后一个最划算.因为只要炸到一艘即可,所以答案减去a-…
A. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In order to make the "Sea Battle" game more interesting, Boris decided to add a new ship type to it. The ship consists of…
A. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In order to make the "Sea Battle" game more interesting, Boris decided to add a new ship type to it. The ship consists of…
目录 Codeforces 1131 A.Sea Battle B.Draw! C.Birthday D.Gourmet choice(拓扑排序) E.String Multiplication(思路) F.Asya And Kittens(链表) G.Most Dangerous Shark Codeforces 1131 比赛链接 hack一个暴力失败了两次最后还是没成功身败名裂= = CF跑的也太快了吧... 不过倒也涨了不少. A.Sea Battle //想麻烦了,但是无所谓... #…
https://www.cnblogs.com/31415926535x/p/10427505.html codeforces-1131A~G 这场很多题都很简单,,应该是要能至少做出4道的,,但是我一道wa了懵逼一道不知道如何写代码实现链表,,又是掉分场,,QAQ,,, A. Sea Battle 求两个左对齐的矩形的外围一圈的面积(方格数),,,一开始去想着一层一层的找规律去推公式去了,,,推到一半发现越来越乱,,又想了一会才想起直接分成两个矩形:红色的扩大一圈后的和去掉一层后的蓝色的矩形的…
D. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output 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 con…
因为这次难得不在十点半(或是更晚),大家都在打,然后我又双叒叕垫底了=.= 自己对时间的分配,做题的方法和心态还是太蒻了,写的时候经常写一半推倒重来.还有也许不是自己写不出来,而是在开始写之前就觉得自己写不出来 多打CF A.Sea Battle 讨论.jpg 也有式子的解法,我没想 B.Draw 讨论失败.jpg (写题顺序:ADFC,没有B) 讨论个**,转化成线段求交,答案就是$\sum max(0,min(x,y)-max(lstx,lsty)+(lstx!=lsty))$,记得加上一开…
链接:http://codeforces.com/contest/1131 A Sea Battle 利用良心出题人给出的图,不难看出答案为\(2*(h1+h2)+2*max(w1,w2)+4\)由于\(w2 \leq w1\),所以答案为\(2*(h1+h2)+2*w1+4\) #include<cstdio> int w1,h1,h2,w2,ans; int main(){ scanf("%d%d%d%d",&w1,&h1,&w2,&h2…
D. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output 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 con…
A. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In order to make the "Sea Battle" game more interesting, Boris decided to add a new ship type to it. The ship consists of…
Battle ships Problem DescriptionDear contestant, now you are an excellent navy commander, who is responsible of a tough mission currently.Your fleet unfortunately encountered an enemy fleet near the South Pole where the geographical conditions are ne…
二分图匹配: 分别按行和列把图展开.hungary二分图匹配. ... 例子: 4 4 *ooo o### **#* ooo* 按行展开. .. . *ooo o#oo oo#o ooo# **#o ooo* ooo* 再按列展开... 7 * 8 *ooooooo oooooooo oooooooo oooooooo *o*ooooo ooooooo* ooooooo* 匹配结果3 Battle ships Time Limit: 2000/1000 MS (Java/Others)    M…
Battle ships Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1007    Accepted Submission(s): 353 Problem Description Dear contestant, now you are an excellent navy commander, who is responsible…
* 为什么要模块化? 解决文件依赖 解决命名冲突 ; var var2 = 2; function fn1(){ } function fn2(){ } return { fn1: fn1, fn2: fn2 }; })(); node.js中的模块化 node中模块的引入是同步的,遵循CommonJS规范. sea.js        遵循CMD (通用模块定义) ,对于依赖的模块,就近依赖,延迟执行. sea.js写法 define(function(require,exports,modu…
在使用sea.js的如下写法引用jQuery文件时, //main.jsdefine(function(require,exports,module){ var $ = require('jquery-3.1.0.min'); $('#name').html('helloworld'); }) 会报错,提示$ is not a function: 原因在于jQuery是默认支持AMD规范的,而sea.js是遵循CMD规范进行加载:这两种规范对外提供模块时的定义方法不一样: // CMD defi…