UVALive 6320
.............先让我哭一会.......
因为样例三.... 没敢敲...然后确实是样例错了...然后...上次比赛刚做过的一道类似的题...URAL 1941...大水题啊......悔青了....哭瞎了...比赛不只是智力和实力的比拼啊......aaa...
同样的给你两个字符串.问你第二个是不是第一个字串.所谓字串,这里是说字母个数完全相同两部分就可以了。
#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std; char str1[], str2[];
int num[], num2[]; int main()
{
int t;
cin >> t;
while(t--)
{
memset(num2, , sizeof(num2));
memset(num, , sizeof(num));
cin >> str1;
int len = strlen(str1);
for (int i=; i<len; ++i)
{
num[i] = str1[i] - 'a';
}
cin >> str2;
int len2 = strlen(str2);
for (int i=; i<len2; ++i)
{
int temp = str2[i] - 'a';
num2[temp]++;
}
int st = ;
bool flag = false;
for (int i=; i<len; ++i)
{
num2[num[i]]--;
while(num2[num[i]] < )
{
num2[num[st]]++;
st++;
}
if (i-st+ == len2)
{
flag = true;
break;
}
}
if (flag)
cout << "YES\n";
else cout << "NO\n";
}
returl ;
}
LOoK
UVALive 6320的更多相关文章
- UVALive - 4108 SKYLINE[线段树]
UVALive - 4108 SKYLINE Time Limit: 3000MS 64bit IO Format: %lld & %llu Submit Status uDebug ...
- UVALive - 3942 Remember the Word[树状数组]
UVALive - 3942 Remember the Word A potentiometer, or potmeter for short, is an electronic device wit ...
- UVALive - 3942 Remember the Word[Trie DP]
UVALive - 3942 Remember the Word Neal is very curious about combinatorial problems, and now here com ...
- 思维 UVALive 3708 Graveyard
题目传送门 /* 题意:本来有n个雕塑,等间距的分布在圆周上,现在多了m个雕塑,问一共要移动多少距离: 思维题:认为一个雕塑不动,视为坐标0,其他点向最近的点移动,四舍五入判断,比例最后乘会10000 ...
- UVALive 6145 Version Controlled IDE(可持久化treap、rope)
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_ ...
- UVALive 6508 Permutation Graphs
Permutation Graphs Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit ...
- UVALive 6500 Boxes
Boxes Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Pract ...
- UVALive 6948 Jokewithpermutation dfs
题目链接:UVALive 6948 Jokewithpermutation 题意:给一串数字序列,没有空格,拆成从1到N的连续数列. dfs. 可以计算出N的值,也可以直接检验当前数组是否合法. # ...
- 【暑假】[实用数据结构]UVAlive 3135 Argus
UVAlive 3135 Argus Argus Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %l ...
随机推荐
- 20145319 《网络渗透》web安全基础实践
20145319 <网络渗透>web安全基础实践 问题回答 Sql注入攻击原理,如何防御 攻击原理:由于对于用户输入并没做出相应限制,因此可以通过构造特定的sql语句,达到自身的一些非法目 ...
- 在awk中通过system调用sql语句来说明引号的使用
一个实际应用例子: 在awk中,通过system调用连接数据库并作select操作,select语句中where条件来自于一个文件(file)的第一个域($1). $ cat file ... ... ...
- luoguP2826 LJJ的数学课
思路 把公式拆开维护两个值,一个a[i]的总和,一个a[i]*i的总和 也可以用树状数组维护,模板题 代码 #include <iostream> #include <vector& ...
- SqlParameter 参数化模糊查询
sql += " and a.f_fullName like N'%'+@fullName+'%'";
- MVC ---- T4模板的小练习
1.先建立两个模板文件 :Manger.ttinclude.DBHelper.ttinclude Manger.ttinclude <#@ assembly name="System. ...
- Codeforces Beta Round #95 (Div. 2) C. The World is a Theatre 组合数学
C. The World is a Theatre There are n boys and m girls attending a theatre club. To set a play " ...
- ros python 订阅robot_pose
#!/usr/bin/env python import rospy import tf import time from tf.transformations import * from std_m ...
- Android开机广播和关机广播
有些时候我们需要我们的程序在系统开机后能自动运行,这个时候我们可以使用Android中的广播机制,编写一个继承BroadcastReceiver的类,接受系统启动关闭广播.代码如下: /** *@au ...
- JavaScript算法相关
1. 不使用循环,创建一个长度为100的数组,并且每个元素的值等于它的下标? Array.apply(null, {length: N}).map(Function.call, Number); Ar ...
- box-shadow四周都有阴影
<style> .shadow{ -webkit-box-shadow: #666 0px 0px 10px; -moz-box-shadow: #666 0px 0px 10px; bo ...