【补解体报告】topcoder 634 DIV 2
A:应该是道语文题,注意边界就好;
B:开始考虑的太复杂,没能够完全提取题目的思维。
但还是A了!我愚蠢的做法:二分答案加暴力枚举,
枚举的时候是完全模拟的,比如每次取得时候都是从大到小的去取,最后统计答案!
好吧!忽略这种SB做法,只是提供一种当你想不到的时候,一种暴力破解的思路!
看到的一种正解:我们每次可以取(N-1)个,而且不用加入答案中,
先上代码:
for (int i=0;i<s.size();i++)
sum+=s[i];
return max(0,sum-N*(m-1));很简短。
C 题:
构造题,想想也没想法,暴力是很好用的。
http://blog.csdn.net/codebattle/article/details/39612609 思路来源!
我们可以从后往前进行枚举当且遇到‘0’时进行修改,
然后去枚举该位置之后的数,每次假设当它为’0‘时,看是否满足。
复杂度大概是O(N^3);
具体看前面大神博客的代码
【补解体报告】topcoder 634 DIV 2的更多相关文章
- [NOIP11.1模拟赛]补番报告
Preface 昨天开始补某科学的超电磁炮S 感觉今天就好了点,炮姐赛高 T1 一开始一直想欧拉定理&ex欧拉定理,结果估计70分,数组开小了GG,看了正解发现是我学傻了 T2 一看就是数据结 ...
- TopCoder[SRM513 DIV 1]:Reflections(1000)
Problem Statement Manao is playing a new game called Reflections. The goal of the game is trans ...
- Topcoder SRM584 DIV 2 500
#include <set> #include <iostream> #include <string> #include <vector> using ...
- Topcoder SRM583 DIV 2 250
#include <string> #include <iostream> using namespace std; class SwappingDigits { public ...
- Topcoder Srm627 DIV 2
A,B:很水,注意边界,话说HACK都是这些原因. C: R[I][J]:表示反转I-J能改变冒泡排序的次数: DP方程:dp[i][k]=max(dp[j][k],dp[j][k-1]+dp[j][ ...
- Topcoder SRM548 Div 1
1. KingdomAndTrees 给出n个数a[1..n],求一个数组b[1..n]满足b严格递增,且b[1]>=1. 定义代价为W = max{abs(a[i]-b[i])},求代价最小值 ...
- 补题—Codeforces Round #346 (Div. 2) _智商欠费系列
这次的题目相对容易 但是智商依旧不够用 原因有三点 1.英文水平堪忧 2 逻辑不严密 3 细节掌握不够好 传送门 http://codeforces.com/contest/659 A 题目大意 圆环 ...
- TopCoder[SRM587 DIV 1]:TriangleXor(550)
Problem Statement You are given an int W. There is a rectangle in the XY-plane with corners at ...
- TopCoder[SRM587 DIV 1]:ThreeColorability(900)
Problem Statement There is a H times W rectangle divided into unit cells. The rows of cells are ...
随机推荐
- PHP-You don’t have permissions to access xxx on this server!
问题如下图: 如果你是想要查看目录下的每一个文件,那么你需要修改一下httpd-conf配置文件,也就是apache的配置文件,以phpStudy2013为例,如下图打开: 然后找到如下部分,添加 ...
- ASP.NET MVC5学习笔记之Controller执行ControllerDescriptor和ActionDescriptor
一. ControllerDescriptor说明 ControllerDescriptor是一个抽象类,它定义的接口代码如下: public abstract class ControllerDes ...
- Oracle11g install Bbed
1.sbbdpt.o ssbbded.o bbedus.msb文件链接地址: http://pan.baidu.com/s/1c0tHMCS 2.DB: Oracle Database 11g En ...
- Virtual Box + CentOS Minimal + Apache搭建Web服务器
本文并不介绍关于Virtual Box, CentOS, Apache的安装, 主要针对安装后相关的配置, 使宿主机(Host)可以访问客户机(Guest: CentOS in Virtual Box ...
- hdu 5427 A problem of sorting
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5427 A problem of sorting Description There are many ...
- 九度oj 1554 区间问题
原题链接:http://ac.jobdu.com/problem.php?pid=1554 由数列的前缀和:$\begin{align*}\Large{} S_n &=\Large{}\sum ...
- Convert Geometry data into a Geography data in MS SQL Server
DECLARE @geog GEOGRAPHY; DECLARE @geom GEOMETRY; ); SET @geom = @geom.MakeValid() --Force to valid g ...
- ios中怎么样判断路径最后的后缀名称
使用hasSuffix属性即可 例如 [photo.thumbnail_pic.lowercaseString hasSuffix:@"gif"]
- 3.Knockout.Js(属性绑定)
前言 让visible绑定到DOM元素上,使得该元素的hidden或visible取决于绑定的值. 简单的绑定 首先还是先定义一个ViewModel var AppViewModel = { shou ...
- ios8/sdk8/xcode6/iphone6(+)适配
AppIcon https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Ic ...