UVA 231 Testing the CATCHER【更正】
来源:互联网 发布:一叶而知天下秋 编辑:程序博客网 时间:2024/04/27 11:21
题目大意:输出最长递减子序列长度,LIS简单变形。
解题策略:LIS简单变形,注意输出和格式。
之前不注意把wa的代码贴上来,晕……
/* UVA 231 Testing the CATCHER AC by J.Dark ON 2013/3/31 Time 0.008s*/#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 100000;int num[maxn], length[maxn];int testCase, numCount;/////////////////////void Solve(){ for(int i=1; i<=numCount; i++) length[i] = 1; for(int i=1; i<=numCount; i++){ for(int j=i+1; j<=numCount; j++){ if(num[j] < num[i]){ //严格递减 length[j] = max(length[j], length[i]+1); } } } int minAns = 0; for(int i=1; i<=numCount; i++) minAns = max(minAns, length[i]); if(testCase > 1) printf("\n"); printf("Test #%d:\n", testCase); //控制格式 printf(" maximum possible interceptions: %d\n", minAns);}int main(){ int temp, endCount=0; //endCount控制输出。防止死循环 numCount = testCase = 0; while((cin >> temp) && (endCount!=2)) { if(temp != -1){ num[++numCount] = temp; endCount = 0; }else{ endCount++; if(endCount != 2){ testCase++; Solve(); } numCount = 0; } } //system("pause"); return 0;}
- UVA 231 Testing the CATCHER【更正】
- uva 231 Testing the CATCHER
- uva 231 Testing the CATCHER
- UVa 231 - Testing the CATCHER
- Testing the CATCHER
- Testing the CATCHER (P1887)
- UVa231 - Testing the CATCHER
- POJ1887--Testing the CATCHER
- poj1887 Testing the CATCHER
- POJ1887 Testing the CATCHER
- Testing the CATCHER
- POJ1887 Testing the CATCHER
- poj1887 Testing the CATCHER
- 最长单调递减子序列(非严格单调) uva 231Testing the CATCHER
- PKU 1887 Testing the CATCHER
- pku 1887 Testing the CATCHER
- poj 1887 Testing the CATCHER
- poj 1887 Testing the CATCHER
- 第一次作业(读后感与感慨)
- 本周对直立控制方案中直立控制的知识所学总结
- android实现拨号功能
- poj 3308 最小割
- 软件测试-软件工程-第七章
- UVA 231 Testing the CATCHER【更正】
- C++笔试面试一些题汇总
- 统计一个字符串中大写字母,小写字母,以及数字的个数。
- 两个字符串复制(指针)
- fastjson jar包下载地址
- 智能化系统工程施工阶段划分
- [03/31/2013][Android]Power off Charge 总结
- 第二次C语言设计上机报告
- 游戏后台里的通用技术之环形缓冲区