POJ 1936 All in All C++版

题目链接:http://poj.org/problem?id=1936

题目问是否能在字符串t中去掉一些字母组成字符串s,一个简单的题目,用指针轻松解决,可是WA了3次才发现我输出的yesno是小写,郁闷了半天

代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*Problem: 1936		User: awq123
**Memory: 400K Time: 0MS
**Language: C++ Result: Accepted
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main()
{
char s[100005],t[100005];
while(cin>>s>>t)
{
int ok=0;
char *ps=s,*pt=t;
while(1)
{
if(*ps=='\00')
{
ok=1;
break;
}
if(*pt=='\00')
break;
if(*ps==*pt)
ps++;
pt++;
}
if(ok)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
}