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

果然大水啊

Posted by KatrineYang at 2016-11-16 11:14:51 on Problem 1936
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <cmath>

using namespace std;

char s[100005], t[100005];

bool solve(char *s, char *t){
	int sl = strlen(s), tl = strlen(t);
	if(sl > tl) return 0;
	int sf = 0, tf = 0;
	while(sf < sl && sl-sf <= tl-tf){
		if(s[sf]==t[tf]) sf++;
		tf++;
	}
	if(sf == sl) return 1;
	return 0;
}

int main(int argc, char **argv){
	while(scanf("%s%s", s, t) == 2){
		printf(solve(s,t)? "Yes\n": "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