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 |
为啥在我的电脑上就能过,但就是被RE了呢?性质太恶劣了。大牛们,指点指点小弟吧!#include<stdio.h> #include<stdlib.h> #include<string.h> int Finds(int i,char c,char s[]); int main() { unsigned int n,i,g,h,d,r,p,k; char s[110]; char t[110]; scanf("%d",&n); for(i=0;i<n;i++) { h=0; d=0; p=0; scanf("%s %s",s,t); for(g=0;g<strlen(s)&&h<strlen(t);g=d) { d=Finds(g,t[h],s); h++; } for(r=strlen(t)-1,k=0;k<strlen(s)&&r>=0;k=p) { p=Finds(k,t[r],s); r--; } if(h==strlen(t)-1) { printf("YES\n"); } else if(r==0) { printf("YES\n"); } else { printf("NO\n"); } } return 0; } int Finds(int i,char c,char s[]) { unsigned int j,k; for(j=i;j<strlen(s);j++) { if(s[j]==c) { k=j; } } return k; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator