偷吃糖果
Time Limit: 1000Ms
Memory Limit: 65536KB
Description
Input
Sample Input
2
rrrjj
rrrj
rj
jr
Sample Output
Yes
No
Hint
/*
思路:
把连续相同的缩成一个字母,然后对比一下即可
hhh-2016-04-17 13:01:22
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <math.h>
using namespace std;
#define lson (i<<1)
#define rson ((i<<1)|1)
typedef long long ll;
const int mod = 1000000009;
const int maxn = 1100;
char s1[maxn];
char s2[maxn];
char str1[maxn];
char str2[maxn];
int main()
{
int t;
scanf("%d", &t);
while(t--)
{
int tot1,tot2;
scanf("%s%s",s1,s2);
tot1 = tot2 = 0;
str1[tot1++] = s1[0];
for(int i=1; s1[i]!='\0'; i++)
{
if(s1[i]!=s1[i-1]) str1[tot1++]=s1[i];
}
tot2 = 0;
str2[tot2++] = s2[0];
for(int i=1; s2[i]!='\0'; i++)
{
if(s2[i]!=s2[i-1]) str2[tot2++]=s2[i];
}
if(tot1!=tot2) printf("No\n");
else
{
bool flag = true;
for(int i=0; i<tot1; i++)
{
if(str1[i]!=str2[i])
{
flag = false;
break;
}
}
if(flag) printf("Yes\n");
else printf("No\n");
}
}
return 0;
}
count_prime
Time Limit: 1000ms
Memory Limit: 65536KB
388



被折叠的 条评论
为什么被折叠?



