SRM 591 div1 275
2024-10-19 06:23:43
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!
最新文章
- ABP架构设计交流群-上海线下交流会的内容分享(有高清录像视频的链接)
- codeforces#271 (Div. 2)预处理
- Android拓展系列(10)--使用Android Studio阅读整个Android源码
- Java内存管理的9个小技巧
- 构建前端Mock Server
- 王帅:深入PHP内核
- PHP中的empty()和isset()的比较
- python----特性003
- jsp中怎么调用java类中的方法
- C 结构体零散知识点
- 1692: [Usaco2007 Dec]队列变换|后缀数组|贪心
- Polya计数
- Vuejs的$watch实现原理
- Suricata之outputs(输出选项)
- 使用NSIS制作安装包
- python 判断一个数字是否为3的幂
- jdk源码
- 跨域 cookies
- zoj 3370(二分+二分图染色)
- 一個新的面試題目,leetcode上面可以找到shortest palindrome
热门文章
- HTTP协议状态码详解(HTTP Status Code)
- SQLSERVER DBA容易犯的十个错误
- ArcMap 连接SDE 出错&ldquo;Failed to connect to the specified server. Entry for SDE instance no found in services file.&rdquo;
- 在Visio2010中修改默认字体的大小
- Android---组件篇---Handler的使用(1)[转]
- 专题:点滴Javascript
- nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element &#39;beans&#39;.
- webView文本长按显示英文
- 《.NET 编程结构》专题汇总(C#)
- spider autohome (1)