| ||||||||||
| 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:我的16ms啊,怎么搞成0ms 啊。我实在是想不到In Reply To:Re:我的16ms啊,怎么搞成0ms 啊。我实在是想不到 Posted by:threedonkey at 2011-07-27 17:34:07 #include <cstdio>
#include <cstring>
#include <cctype>
#include <algorithm>
using namespace std;
#define MAXL 100010
char s[MAXL], t[MAXL];
int Strchr(int k){
for(int i = 0; t[i] != '\0'; ++ i)
if(t[i] == s[k]) return i;
return -2;
}
bool find(){
int i, j, pre = 0, now;
for(i = 0; s[i] != '\0'; ++ i){
now = Strchr(i);
if(now < pre) return false;
for(j = pre; j <= now; ++ j) t[j] = '@';
pre = now;
}
return true;
}
int main(){
while(~scanf("%s %s", &s, &t)){
if(find()) printf("Yes\n");
else printf("No\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