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 ...
随机推荐
- nginx ssi 配置小细节(一)
最近工作需要使用nginx的ssi (server side include)技术,在这里,将使用中的一点心得分享一下,也是一种备忘! 首先,nginx的ssi启用很简单,就只有三个最基本的指令: s ...
- 用Opera Mobile调试手机版网页【转】
注意:新版本的opera已经采用webkit内核,没有dragonfly了. 要下载12版的http://get.geo.opera.com/pub/opera/win/1216/int/Opera_ ...
- linux 解压,源码包
从网络上下载到的源码包, 最常见的是 .tar.gz 包, 还有一部分是 .tar.bz2包 要解压很简单 : .tar.gz 格式解压为 tar -zxvf ...
- (转)关于List中FindAll用法的一些简单示例
本文转载自:http://blog.csdn.net/luoxufeng/article/details/6925982 using System; using System.Collections. ...
- 学习C++11的一些思考和心得(1):lambda,function,bind和委托
1.lambda表达式 lanbda表达式简单地来讲就是一个匿名函数,就是没有名称的函数,如果以前有接触过python或者erlang的人都比较熟悉这个,这个可以很方便地和STL里面的算法配合 st ...
- item30,最小的k个数
剑指offer给出两类方法: 1,借助快排的思想,需要修改输入数组的元素,时间复杂度O(n) 2,借助STL中set或者multiset,因为它们的底层数据结构是红黑树实现的,插入数据时间复杂度为O( ...
- Java I/O学习(附实例和详解)
原文地址:http://blog.csdn.net/u013142781/article/details/50814649 一.Java I/O类结构以及流的基本概念 在阅读Java I/O的实例之前 ...
- JavaScript中回调函数的使用
在JavaScript中,回调函数具体的定义为:函数A作为参数(函数引用)传递到另一个函数B中,并且这个函数B执行函数A.我们就说函数A叫做回调函数.如果没有名称(函数表达式),就叫做匿名回调函数. ...
- [CSS]图片与文字对齐问题
摘自:张鑫旭-鑫空间-鑫生活[http://www.zhangxinxu.com] 图片与文字默认是居底对齐了.所以当图片与文字在一起的时候往往都是不对齐的.尤其图片较小时就更加明显了,我看到很多人使 ...
- php 自带过滤和转义函数
函数名 释义 介绍 htmlspecialchars 将与.单双引号.大于和小于号化成HTML格式 &转成&"转成"' 转成'<转成<>转成> ...