邵阳市建设工程造价管理站网站,做网站建设的目的,网站制作手机端,传统网站建设题目链接如下#xff1a;
Online Judge
这道题折磨了我不少时间#xff0c;开始比较直观的想法超时#xff0c;后来看了下别人的思路修改后才AC。
刘汝佳的代码很简洁#xff0c;UVa 11988 悲剧文本#xff08;四种方法#xff09;_uva11988-CSDN博客 这里有。
还有下…题目链接如下
Online Judge
这道题折磨了我不少时间开始比较直观的想法超时后来看了下别人的思路修改后才AC。
刘汝佳的代码很简洁UVa 11988 悲剧文本四种方法_uva11988-CSDN博客 这里有。
还有下面这个方法也非常巧妙UVA 11988_uva - 11988-CSDN博客
我的代码如下
#include iostream
#include string
#include vector
// #define debugint main(){#ifdef debugfreopen(3.txt, r, stdin);freopen(1.txt, w, stdout);#endifstd::string str;while (getline(std::cin, str)){int i, start, end, curr, s, t;std::vectorint next(str.size());for (i 0; i str.size(); i){if (i str.size() - 1 || str[i 1] [ || str[i 1] ]){next[i] -1;} else {next[i] i 1;}}start -1;i 0;while (str[i] [ || str[i] ]){i;}start i;for (; i str.size(); i){if (str[i] [ || str[i] ]){break;}}end i - 1;while (i str.size() - 1){int temp str[i] [ ? 1 : 0;i;s i;for (; i str.size(); i){if (str[i] [ || str[i] ]){break;}}t i - 1;if (s t){continue;}if (temp){next[t] start;start s;} else {next[end] s;end t;}}curr start;while (curr ! -1){printf(%c, str[curr]);curr next[curr];}printf(\n);}#ifdef debugfclose(stdin);fclose(stdout);#endifreturn 0;
}