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 ...
随机推荐
- 在WINDOWS SERVER 上或远程桌面中使用 MUTEX
引用: http://www.cnblogs.com/fg0711/archive/2012/05/03/2480502.html 使用Mutex需要注意的两个细节 可能你已经注意到了,例子中在给Mu ...
- POJ #1015 - Jury Compromise - TODO: POJ website issue
(poj.org issue. Not submitted yet) This is a 2D DP problem, very classic too. Since I'm just learnin ...
- php访问mysql工具类
本文转载自:http://www.cnblogs.com/lida/archive/2011/02/18/1958211.html <?php class mysql { private $db ...
- Python 通过print_lol将数据保存到文件中
1. 定义一个print_lol函数来控制列表的缩进和写入位置 import sys """this is a new fuction, which work for a ...
- 减小Gcc编译程序的体积
众所周知,Gcc编译的原始程序一般很大,其实有几种方法能大大减小目标代码的体积,一般有以下几种方法. 基本知识来源:http://www.mingw.org/wiki/Large_executable ...
- MEF简单示例
原文地址: http://www.cnblogs.com/xiaokang088/archive/2012/02/21/2361631.html MEF 的精髓在于插件式开发,方便扩展. 例如,应用程 ...
- POJ 2411 Mondriaan'sDream(状压DP)
题目大意:一个矩阵,只能放1*2的木块,问将这个矩阵完全覆盖的不同放法有多少种. 解析:如果是横着的就定义11,如果竖着的定义为竖着的01,这样按行dp只需要考虑两件事儿,当前行&上一行,是不 ...
- linux命令(6)crontab的用法和解析
一,写入格式: * * * * * command minute hour day month week command 其中: minute: 表示分钟,可以是从0到59之间 ...
- 张恭庆编《泛函分析讲义》第二章第2节 $Riesz$ 定理及其应用习题解答
在本节中, $\scrH$ 均指 $Hilbert$ 空间. 1.在极大闭子空间的交的最佳逼近元 设 $f_1,f_2,\cdots,f_n$ 是 $\scrH$ 上的一组线性有界泛函, $$\bex ...
- [物理学与PDEs]第1章 电动力学
[物理学与PDEs]第1章第1节 引言 [物理学与PDEs]第1章第2节 预备知识 2.1 Coulomb 定律, 静电场的散度与旋度 [物理学与PDEs]第1章第2节 预备知识 2.2 Ampere ...