Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:我的16ms啊,怎么搞成0ms 啊。我实在是想不到

Posted by threedonkey at 2011-07-27 17:34:20 on Problem 1936
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator