Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
在测试数据中我的程序为什么有三组数据通不过???有谁能够帮帮我根据上面提供的测试数据发现我的程序中有三组数据判断错误,无法判定其为永真式,其他的都正确,请你们看看我的哪有问题,麻烦指点下: #include<iostream> #include<string.h> using namespace std; char a[105]; int p,q,r,s,t,n=-1,m=1; int tautology() { n++; switch(a[n]) { case 'p':return p; case 'q':return q; case 'r':return r; case 's':return s; case 't':return t; case 'N':return !tautology(); case 'A':return tautology()||tautology(); case 'K':return tautology()&&tautology(); case 'C':return (!tautology())||tautology(); case 'E':return tautology()==tautology(); } } int main(void) { while((cin>>a)&&a[0]!='0') { for(p=0;p<2&&(m==1);p++) for(q=0;q<2&&(m==1);q++) for(r=0;r<2&&(m==1);r++) for(s=0;s<2&&(m==1);s++) for(t=0;t<2&&(m==1);t++) { m=tautology(); n=-1; } if(m==1) printf("tautology\n"); else printf("not\n"); //memset(a,0,105); m=1; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator