问题描述
- 关于POJ-3561,求找错~
-
#include <stdio.h> int main() { int N; scanf("%d",&N); for(;N > 0;N--){ char a[100]; int m,n,hen,shu,you,zuo,ju,Hen,You,Zuo,Shu,line; hen = shu = zuo = you = -1; Hen = You = Zuo = ju = Shu = -1; line = 0; scanf("%d %d",&n,&m); getchar(); for(;n > 0;n--){ gets(a); for(int i = 0;i < m;i++){ switch(a[i]){ case '-': if(hen == -1 && Hen == -1 ){ line++; hen = i; ju = 1; Hen = n; } else if(hen + 1 == i && Hen == n ){ hen = i; } else{ ju = 0; } break; case '|': if(shu == -1 && Shu == -1 ){ line++; shu = i; ju = 1; Shu = n; } else if(shu == i && Shu - 1 == n ){ ju = 1; Shu = n; } else{ ju = 0; } break; case '\': if(you == -1 && You == -1 ){ line++; you = i; ju = 1; You = n; } else if(you + 1 == i && You - 1 == n ){ you = i; You = n; } else{ ju = 0; } break; case'/': if(zuo == -1 && Zuo == -1 ){ line++; zuo = i; ju = 1; Zuo = n; } else if(zuo - 1 == i && Zuo - 1 == n ){ zuo = i; Zuo = n; } else{ ju = 0; } break; } } } if(ju == 1 && line == 1) printf("CORRECTn"); else printf("INCORRECTn"); } return 0; }
一直wa,求助!
谢谢了!
解决方案
看不明白你的问题。
时间: 2025-01-09 06:49:31