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 |
|| 与 | int 与 boolRT 正确的代码将t1,t2改成了int就WA,或者将||改成|也WA,求解。。。。 #include <stdio.h> #include <string.h> char data[10005]; int value; int position = 0; int getValue() { switch(data[position++]) { bool t1,t2; case 'p': return (value & (1 << 0)); case 'q': return (value & (1 << 1)); case 'r': return (value & (1 << 2)); case 's': return (value & (1 << 3)); case 't': return (value & (1 << 4)); case 'N': return !getValue(); case 'K': t1 = getValue(); t2 = getValue(); return t1 & t2; case 'A': t1 = getValue(); t2 = getValue(); return t1 | t2; case 'C': t1 = getValue(); t2 = getValue(); return (!t1 | t2); case 'E': t1 = getValue(); t2 = getValue(); return (!(t1^t2)); } } int main() { while(scanf("%s", data) != EOF) { if(strcmp(data, "0") == 0) { break; } for(value = 0; value < (1 << 5); value++) { position = 0; if(getValue() == 0) { printf("not\n"); break; } } if(value >= (1 << 5)) printf("tautology\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator