摘要:
http://poj.org/problem?id=1363通过栈模拟,检验有无可能实现输入和输出 1 #include<stdio.h> 2 int sum; 3 int *in,*out,*stack; 4 int inpoint,outpoint,stackpoint; 5 int is_ok() 6 { 7 inpoint=-1,outpoint=0,stackpoint=-1; 8 while(outpoint<sum) 9 {10 if(stackpoint>-1)11 {12 while(out[outpoint]!=stack[stackpoint]&a 阅读全文
摘要:
http://poj.org/problem?id=1102简单模拟 1 #include<stdio.h> 2 #include<string.h> 3 char n1[11]="- -- -----"; 4 char n2[21]="|| | | |||| | |||||"; 5 char n3[11]=" ----- --"; 6 char n4[21]="|| || | | ||| ||| |"; 7 char n5[11]="- -- -- --"; 8 voi 阅读全文
摘要:
http://poj.org/problem?id=1028一道栈模拟题目,要注意地方只有一个,就是当在栈中某处访问新地址后,不能再访问栈此处之后的地址,只能访问之前的。 1 #include<stdio.h> 2 char str[200][71]={"http://www.acm.org/"}; 3 int point=0,end=0; 4 void forword() 5 { 6 if(point>=end) printf("Ignored\n"); 7 else printf("%s\n",str[++poi 阅读全文
摘要:
http://poj.org/problem?id=1008一道日历转换题,要注意%和/符号的运用,还要注意一年的最后一天在/运算符的作用下算作第二年,给数据:4. uayet 259正解是 13 ahau 364而不是13 ahau 365 1 #include<stdio.h> 2 #include<string.h> 3 char month_Haab[19][20]={"pop","no","zip","zotz","tzec","xul",& 阅读全文