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!

最新文章

  1. ABP架构设计交流群-上海线下交流会的内容分享(有高清录像视频的链接)
  2. codeforces#271 (Div. 2)预处理
  3. Android拓展系列(10)--使用Android Studio阅读整个Android源码
  4. Java内存管理的9个小技巧
  5. 构建前端Mock Server
  6. 王帅:深入PHP内核
  7. PHP中的empty()和isset()的比较
  8. python----特性003
  9. jsp中怎么调用java类中的方法
  10. C 结构体零散知识点
  11. 1692: [Usaco2007 Dec]队列变换|后缀数组|贪心
  12. Polya计数
  13. Vuejs的$watch实现原理
  14. Suricata之outputs(输出选项)
  15. 使用NSIS制作安装包
  16. python 判断一个数字是否为3的幂
  17. jdk源码
  18. 跨域 cookies
  19. zoj 3370(二分+二分图染色)
  20. 一個新的面試題目,leetcode上面可以找到shortest palindrome

热门文章

  1. HTTP协议状态码详解(HTTP Status Code)
  2. SQLSERVER DBA容易犯的十个错误
  3. ArcMap 连接SDE 出错&ldquo;Failed to connect to the specified server. Entry for SDE instance no found in services file.&rdquo;
  4. 在Visio2010中修改默认字体的大小
  5. Android---组件篇---Handler的使用(1)[转]
  6. 专题:点滴Javascript
  7. nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element &#39;beans&#39;.
  8. webView文本长按显示英文
  9. 《.NET 编程结构》专题汇总(C#)
  10. spider autohome (1)