| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3137 人关注过本帖, 1 人收藏
标题:[讨论]第四期题目,大家做做.
取消只看楼主 加入收藏
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
结帖率:50%
收藏(1)
 问题点数:0 回复次数:12 
[讨论]第四期题目,大家做做.

All in All

--------------------------------------------------------------------------------

Time limit: 1 Seconds Memory limit: 32768K
Total Submit: 2329 Accepted Submit: 763

--------------------------------------------------------------------------------
You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss in detail how the strings are generated and inserted into the original message. To validate your method, however, it is necessary to write a program that checks if the message is really encoded in the final string.
Given two strings s and t, you have to decide whether s is a subsequence of t, i.e. if you can remove characters from t such that the concatenation of the remaining characters is s.


Input

The input contains several testcases. Each is specified by two strings s, t of alphanumeric ASCII characters separated by whitespace. Input is terminated by EOF.


Output

For each test case output, print "Yes" if s is a subsequence of t or "No" if not.


Sample Input

sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter


Sample Output

Yes
No
Yes
No

/*英语好的帮忙翻译一下,谢了*/

搜索更多相关主题的帖子: 题目 讨论 
2006-12-03 20:09
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 

Ones

--------------------------------------------------------------------------------

Time limit: 1 Seconds Memory limit: 32768K
Total Submit: 1799 Accepted Submit: 854

--------------------------------------------------------------------------------

Given any integer 0 <= n <= 10000 not divisible by 2 or 5, some multiple of n is a number which in decimal notation is a sequence of 1's. How many digits are in the smallest such a multiple of n?


Sample Input

3
7
9901


Sample Output

3
6
12

/*给出一个不能被2和5整除的数,问这个数可以被最少的几个1组成的数整除*/


倚天照海花无数,流水高山心自知。
2006-12-03 20:11
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 
我不是郭靖斑竹的算法是正确的.
不需要设置很高的存储类型.

倚天照海花无数,流水高山心自知。
2006-12-03 20:56
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 
我不是郭靖斑竹的程序,过了,效率和我的那个差不多.用时0.001S.
unicorn斑竹的因为有格式问题,没有测试,但看整个程序来说,算法还是对的.

倚天照海花无数,流水高山心自知。
2006-12-03 22:26
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 
哦,对了.
这期的相对简单很多.上一期的比较难点,希望大家继续做第三期的,那期的也没什么人做.

倚天照海花无数,流水高山心自知。
2006-12-03 22:28
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 
以下是引用meiling01在2006-12-4 10:48:31的发言:
to:我不是郭靖版主:麻烦你讲解一下您的第二题的编程思路吧,我能够看懂,但却不懂深层次的原理,麻烦您能讲一下。谢谢!

只要理解(a*b)%c==(a%c*b)%c.就可以了.


倚天照海花无数,流水高山心自知。
2006-12-04 23:17
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 
以下是引用angeljune在2006-12-5 0:31:31的发言:
我很笨啊,第二题题目是啥意思啊,

/*给出一个不能被2和5整除的数,问这个数可以被最少的几个1组成的数整除*/
比如是3.当然是111(最少要3个1组成的数)可以整除3了.
再比如7.那就输出111111.(因为111111是由1组成数中可以整除7的最小数).

关于这个题目,想到一个理解方法就是小学的除法运算.
大家都知道,当不够位除时,后总补0除,我们这里当然也可以补1除了.这样得出的结果不就是由1组成的数了.


倚天照海花无数,流水高山心自知。
2006-12-05 13:31
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 
以下是引用zhanghuan_10在2006-12-5 14:57:54的发言:

第二题提交之后出现了这个是什么意思啊?SIGSEGV
#include <stdio.h>
#include <string.h>
#define N 100
#define M 100

int main(void)
{
char str1[N], str2[M];
int i, n = 0, step1 = 0, step2 = 0;

while(scanf("%s", str1) != EOF)
{
scanf("%s", str2);
for(i = 0;i < strlen(str2);i ++)
{
if(str1[step1] == str2[step2])
{
n ++;
step1 ++;
step2 ++;
}
else
{
step2 ++;
}
}
if(n == strlen(str1))
{
printf("YES\n");
}
else
{
printf("NO\n");
}

}

return 0;

}


把数组开大点.


倚天照海花无数,流水高山心自知。
2006-12-05 15:08
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 
数组开的大了之后,就超时了!,哪里.数组开大,只要不超过内存限制就可以.
数据是已经给定了.

倚天照海花无数,流水高山心自知。
2006-12-05 15:33
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 
以下是引用zhanghuan_10在2006-12-5 20:33:31的发言:

#include <stdio.h>

int main(void)
{
int n, j = 1, num = 0;
long long i;

scanf("%d", &n);

for(i = 1;;i = i*10 + j)
{
j = 1;
num ++;
if(i%n == 0)
break;
}
printf("%-5d", num);

return 0;

}


这个绝对不对.因为它的测试里可能有几千位.掌握我前面的提示就理解不需要这样.


倚天照海花无数,流水高山心自知。
2006-12-05 21:53
快速回复:[讨论]第四期题目,大家做做.
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017066 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved