SRM 591 div1 275
topcoder被Appirio收购了
好久没做tc,这个题目挺简单。就是Arena里面看不到图片,只能去tc网站上找题目。http://community.topcoder.com/stat?c=problem_statement&pm=12746
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime> using namespace std; int tmp[];
class TheTree {
public:
int maximumDiameter(vector <int> cnt) {
int D = cnt.size(), i, j;
int ans = , sum; for(i = ; i < D; ++i) {
for(j = i; j < D; ++j) tmp[j] = cnt[j];
sum = ;
for(j = i; j < D; ++j) {
if(tmp[j] != ) {
tmp[j]--;
sum++;
} else break;
}
for(j = i; j < D; ++j) {
if(tmp[j] != ) {
tmp[j]--;
sum++;
} else break;
}
printf("%d\n", sum);
ans = max(ans, sum);
}
return ans;
}
}; <%:testing-code%>
//Powered by KawigiEdit 2.1.8 (beta) modified by pivanof!
SRM 591 div1 275的更多相关文章
- Topcoder SRM 643 Div1 250<peter_pan>
Topcoder SRM 643 Div1 250 Problem 给一个整数N,再给一个vector<long long>v; N可以表示成若干个素数的乘积,N=p0*p1*p2*... ...
- Topcoder Srm 726 Div1 Hard
Topcoder Srm 726 Div1 Hard 解题思路: 问题可以看做一个二分图,左边一个点向右边一段区间连边,匹配了左边一个点就能获得对应的权值,最大化所得到的权值的和. 然后可以证明一个结 ...
- 图论 SRM 674 Div1 VampireTree 250
Problem Statement You are a genealogist specializing in family trees of vampires. Vampire famil ...
- TC SRM 591
表示第一次在div1,我要记录一下... 木有挂0,第一题不怎么难的,读题读了20分钟,又想了20分钟,时间有点长,然后各种小心,然后得了140分.... 后两个题,根本木有看,貌似做出来的也不多.. ...
- SRM 583 DIV1
A 裸最短路. class TravelOnMars { public: int minTimes(vector <int>, int, int); }; vector<int> ...
- SRM 590 DIV1
转载请注明出处,谢谢viewmode=contents">http://blog.csdn.net/ACM_cxlove?viewmode=contents by---cxlov ...
- Topcoder SRM 602 div1题解
打卡- Easy(250pts): 题目大意:rating2200及以上和2200以下的颜色是不一样的(我就是属于那个颜色比较菜的),有个人初始rating为X,然后每一场比赛他的rating如果增加 ...
- 状态压缩DP SRM 667 Div1 OrderOfOperations 250
Problem Statement Cat Noku has just finished writing his first computer program. Noku's compute ...
- 数学 SRM 690 Div1 WolfCardGame 300
Problem Statement Wolf Sothe and Cat Snuke are playing a card game. The game is played with exa ...
随机推荐
- Xshell 使用心得
会话日志,记住指令 默认情况下,它是不会像bash一样记住指令的,要开启指令记忆功能,按下面的操作: FTP
- 微软分布式框架Orleans开源了
开源地址: https://github.com/dotnet/orleans 昨天编译了一下,这个最新的Orleans安装程序(用github源码编译的) 下载地址:http://pan.baidu ...
- 写给自己看的Linux运维基础(三) - Mono
如果使用ubuntu,可使用apg-get安装完mono,xsp,mod_mono,我的yum源并没有找到mono可安装,网上也没找到CentOS的源,最后选择下载编译安装. Stackoverflo ...
- Devexpress GridView内嵌dx:ASPxGridLookup取得控件值乱跳解决方案
一 页面嵌入ASPxGridLookup控件 <dx:ASPxGridView ID="gridDetail" runat="server" ...
- [C#] 编程控制笔记本蓝牙与外部蓝牙设备通信
一.蓝牙模块XLBT232‐D01介绍(外部设备蓝牙) 1.1.蓝牙模块简介 XLBT232-D0101蓝牙模块采用CSR BlueCore 芯片,配置6-8Mbit 的软件存储空间, 支持AT 指令 ...
- [C++] 井字棋游戏源码
TicTac.h #define EX 1 //该点左鼠标 #define OH 2 //该点右鼠标 class CMyApp : public CWinApp { public: virtual B ...
- Android SDK国内代理速度还可以
Android Android SDK 配置步骤 启动 Android SDK Manager ,打开主界面,依次选择「Tools」.「Options...」,弹出『Android SDK Manag ...
- sublime text配置记录
代码编辑器有一直都有在尝试新的,如brackets/vs code/webstrom,最后还是用回sublime,每次要重新安装的时候都需要上网搜索相关配置资料,特些记录,以备下次使用: 下载地址 下 ...
- Swift入门篇-基本类型(3)
一:元组 格式 变量或常量关键字 元组变量 = ( 变量,变量, …) 说明: : 元组变量还是一个变量,只不过表现方式和其他变量不一样 :()括号里面可以放入N个变量组成 例子: import Fo ...
- 编译Ngnix遇到的问题,查看程序依赖的库文件
要点:ldd 可以读取每个可以运行的程序依赖的 so 文件. 编译的时候提示需要Openssl库. 查看本机,已经安装了openssl 查看编译报错文件,查找Openssl所依赖的库 more obj ...