bored
#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中全部被找到,哎,今天做几道题,信心都被磨没啦,好伤心,但是,站起来,世界就是你的!!! 啊啊啊,加油
bored的更多相关文章
- Codeforces822 A I'm bored with life
A. I'm bored with life time limit per test 1 second memory limit per test 256 megabytes input standa ...
- Codeforces Round #422 (Div. 2) A. I'm bored with life 暴力
A. I'm bored with life Holidays have finished. Thanks to the help of the hacker Leha, Noora mana ...
- By virtue of|sustain|post |scrape off |stretch|access to|take into account of|exploit|hasten|blur |idle|bored her to|account for|accused of|cruelty
By virtue of this superior quality, this product is often sold out of stockin many areas. 我们的产品因其优秀的 ...
- [思维题]Bored Qishen
给出一个整数集,其中包含1-n的所有整数,要求挑选出一个元素最多的子集,使得子集中任意两数的乘积不是完全平方数 (n<=10^6) 求这样一个最大子集的元素个数 #include <cst ...
- Gym 101102C Bored Judge(set--结构体集合)
这个故事告诉我们,WA了一定要找自己的原因... ... 当我开始用set去做的时候,发现一直过不去,一开始忘了把初始排名加进去,后来忘了第0秒,第0秒第一的id = 1 这个题目的做法也不只这一种, ...
- A - I'm bored with life
Holidays have finished. Thanks to the help of the hacker Leha, Noora managed to enter the university ...
- 【Codeforces Round #422 (Div. 2) A】I'm bored with life
[题目链接]:http://codeforces.com/contest/822/problem/A [题意] 让你求a!和b!的gcd min(a,b)<=12 [题解] 哪个小就输出那个数的 ...
- Programming Learning - Based on Project
Today when taking a bath I got a good idea that it is an efficient and interesting way to learn a ne ...
- Codeforces Round #384 (Div. 2) 734E Vladik and cards
E. Vladik and cards time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
随机推荐
- 超强封装的RichTextBox控件(C#源码)
有点类似QQ聊天框所带的RichText. 功能进行了RTF的封装,直接调用函数插入图片,连接,特列文字.具体请查看代码 ExRichTextBox_src
- 【linux】windows和linux编码相互转换
windows-->linux:dos2unix file linux-->windows:unix2dos file
- UIDatePicker自定义背景
selectDatePicker = [[UIDatePicker alloc]init]; selectDatePicker.frame = CGRectMake(0, 10, 280, 21 ...
- Python基础(二) —— 字符串、列表、字典等常用操作
一.作用域 对于变量的作用域,执行声明并在内存中存在,该变量就可以在下面的代码中使用. 二.三元运算 result = 值1 if 条件 else 值2 如果条件为真:result = 值1如果条件为 ...
- 免安装Oracle客户端使用PLSQL Developer 7/8 连接Oracle10/11g
众所周知,Oralce的客户端几百兆太大,网上也有许多DIR的处理.这里的处理使用官方提供ORALCE工具包Instant Client Package! 下载地址:http://www.oracle ...
- Mysql存储过程简明使用
mysql> \d // 改变命令行下的结束符标志mysql> create procedure p3() -> begin -> set @i=1; # 这样也可以定义变 ...
- C# 理解lock
本文为转载 .. 一. 为什么要lock,lock了什么? 当我们使用线程的时候,效率最高的方式当然是异步,即各个线程同时运行,其间不相互依赖和等待.但当不同的线程都需要访问某个资源的时候,就需要同步 ...
- Redis几个认识误区(转)
此文的作者是新浪微博平台架构师杨卫华(timyang)大师,如果关注了新浪一些牛人微博的同学应该知道,timyang前段时间正在对Redis进行一些研究和测试,也分享出了不少成果.下面一篇文章相信是t ...
- SpringAOP所支持的AspectJ切点指示器
在spring中尝试使用AspectJ其他指示器时,将会抛出IllegalArgumentException异常. 当我们查看上面展示的这些spring支持的指示器时,注意只有execution指示器 ...
- cf 645F Cowslip Collections 组合数学 + 简单数论
http://codeforces.com/contest/645/problem/F F. Cowslip Collections time limit per test 8 seconds mem ...