![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
模拟题
zhaofukai
行有不得,反求诸己
展开
-
ZOJ 1175 Word Process Machine
<br />这道模拟题有不少细节需要注意。如原来的串中的空行要忽略,最后每行80个字符,两个case之间要有空行等。还要注意不能直接模拟,会超时。可以先预处理一下,如2个R相当于没有没翻转。<br />程序代码:<br />#include <iostream> #include <string> #include <cstdio> #include <algorithm> using namespace std; string Source, Code, Result; void Init()原创 2011-05-04 23:08:00 · 658 阅读 · 0 评论 -
POJ 3509 Rotating Rings
<br /> 这道题思路比较简单,但实现起来比较复杂。首先生成一个排好序的二维数组,然后将要判断的数组一圈的数字存到一个数组中,和已经排序好的数组比较。<br />程序代码:<br />#include <iostream> #include <cstdio> using namespace std; const int MAXN = 1010; int Grids[MAXN][MAXN], Digit[MAXN][MAXN], tGrids[MAXN * 4], tDigit[MAXN *原创 2011-05-03 23:15:00 · 690 阅读 · 0 评论 -
ZOJ 3507 Fractal
<br />这道题实在没想出来,这些日子有点浮躁,静不下心来去想题。看了嵩哥的代码,用递归来做,一层一层去找,若为空格直接返回,否则返回原来的符号。<br />程序代码:<br />#include <iostream> #include <cstdio> #include <cstring> using namespace std; char sour[13][13]; int m, n; char getvalue(int r, int c, int dep) { if(dep原创 2011-05-03 23:25:00 · 705 阅读 · 0 评论 -
POJ 3524 Bug Hunt
<br /> 模拟题,递归来解。注意各种语法:数组先定义,再赋值,下标必须有效等,做的时候要细心。<br />程序代码:<br />#include <iostream> #include <cstdio> #include <map> #include <string> #include <cstring> #include <cctype> using namespace std; string input; typedef struct Node{ int len;原创 2011-05-04 00:00:00 · 690 阅读 · 0 评论 -
HDU 2482 Transit search
实际是一道搜多题。只不过题目叙述过于复杂,读懂后就比较好处理程序代码:#include #include #include #include #include #include #include #include #include #include #include using namespace std; #define exp 1e-9 #define INF 1000000 typedef pair pill; typedef struct原创 2011-05-04 00:05:00 · 1023 阅读 · 4 评论 -
Codeforce # A Plug-in
这道题如果直接在原来的串上模拟删除,会超时,所以用一个栈来存要输出的字符,这样就比较简单了程序代码:#include #include #include #include using namespace std; const int MAXN = 300010; string s; char t[MAXN]; int main() { //freopen("input.txt", "r", stdin); cin>>s; int cnt =原创 2011-05-04 16:21:00 · 568 阅读 · 0 评论 -
Codeforce # B Sequence Formatting
<br /> 这道题题意又没读懂。这句:“if two consecutive numbers were separated by spaces only (one or more), then exactly one of them should be lefe”,意思是两个连续的数中间若有多个空格,只保留一个。而我稀里糊涂的全给删了,结果系统测试Judge掉了<br />程序代码:<br />#include <iostream> #include <string> #include <c原创 2011-05-04 16:26:00 · 713 阅读 · 0 评论 -
POJ 3482 ‘JBC’
这是一道比较复杂的模拟题,注意:1、要用大数来做2、去除串的前导和后导空格3、要求的串中可能存在原来的串没有的符号,这些符号要省略4、貌似最后一个case没有换行,若果用fgets(),可能会出错,但用gets()和getline()没有问题程序代码:#include #include #include #include #include #include #include using namespace std; const int MAXD = 100005, DI原创 2011-05-04 22:31:00 · 660 阅读 · 0 评论 -
ZOJ 1122 Clock
<br />这是一道模拟题,可以先把各个相交的点求出来,然后再一个个去判是否在给的区间里<br />程序代码:<br />#include <iostream> #include <cstdio> using namespace std; typedef struct{ int Houre, Minute; }pill; pill nInitial, nFinal; int nPass[] = {65, 130, 196, 262, 327, 392, 458, 523, 589, 6原创 2011-05-04 22:56:00 · 798 阅读 · 2 评论