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 ...
随机推荐
- JS代码实现网站设为首页加入收藏功能
<script language="javascript"> //加入收藏 function AddFavorite(sURL, sTitle) { try { win ...
- JAVA解析各种编码密钥对(DER、PEM、openssh公钥)
一.DER编码密钥对 先说下DER编码,是因为JCE本身是支持DER编码密钥对的解析的,可以参见PKCS8EncodedKeySpec和X509EncodedKeySpec. DER编码是ASN.1编 ...
- Nexus手动更新索引
如果有耐心的话,完全可以通过在线更新索引的方式来做,但所消耗的时间较长,下面介绍一种简单.可行的方式来手动更新索引文件. 访问http://repo.maven.apache.org/maven2/. ...
- 51nod 1056
n<=10000000000 然后欧拉函数的前缀和可以用莫比乌斯函数的前缀和快速求,注意各种取模 #include<cstdio> typedef long long i64; ,P ...
- 【MySQL】binlog缓存的问题和性能
之前在没有备库的情况下,遇到过more than 'max_binlog_cache_size' bytes of storage 的错误,今天在主备复制的时候又遇到了这个问题 Last_SQL_Er ...
- C#学习笔记二: C#类型详解
前言 这次分享的主要内容有五个, 分别是值类型和引用类型, 装箱与拆箱,常量与变量,运算符重载,static字段和static构造函数. 后期的分享会针对于C#2.0 3.0 4.0 等新特性进行. ...
- MySQL命名、设计及使用规范--------来自标点符的《MySQL命名、设计及使用规范》
原文地址:http://www.biaodianfu.com/mysql-best-practices.html 最近在看MySQL相关的内容,整理如下规范,作为一名刚刚学习MySQL的菜鸟,整理的内 ...
- [JS]Javascript的函数总结
Javascript中不存在函数重载,同名的函数将被最后一个覆盖. function test(a,b){ this.x = 1;} function test(a){ this.x = 2;} fu ...
- Java爬虫搜索原理实现
permike 原文 Java爬虫搜索原理实现 没事做,又研究了一下爬虫搜索,两三天时间总算是把原理闹的差不多了,基本实现了爬虫搜索的原理,本次实现还是俩程序,分别是按广度优先和深度优先完成的,广度优 ...
- htmlparser日记
myParser = Parser.createParser(response, "utf-8");NodeFilter tableFilter = new NodeClassFi ...