bored

https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5375

 #include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
int main()
{
char s1[],s2[];
while(cin>>s1)
{
cin>>s2;
int len1[],count=;
memset(len1,,sizeof(len1));
int l1=strlen(s1);
int l2=strlen(s2);
for(int i=; i<l1; i++)
{
for(int j=; j<l2; j++)
{
if(s1[i]==s2[j])
{
len1[i]=j;
count++;
s2[j]=' ';
break;
}
}
} bool flag=true;
if(count!=l1)
flag=false;
else
for(int i=; i<l1; i++)
{
if(len1[i]<len1[i-])
{
flag = false;
break;
}
}
if(flag)cout<<"PASS"<<endl;
else cout<<"FAIL"<<endl;
memset(s1,NULL,sizeof(s1));
memset(s2,NULL,sizeof(s2));
}
return ;
}

这个代码改啦好久,其实没有什么难得,但是却改啦好久,就是因为考虑问题不全面造成的,因为忘记考虑一种情况,就是有可能str1的字符串不能再str2中全部被找到,哎,今天做几道题,信心都被磨没啦,好伤心,但是,站起来,世界就是你的!!! 啊啊啊,加油

上一篇:struts2中Ajax校验


下一篇:CentOS 7将Python 2.X.X升级到Python 3.X.X