第一,A friend of mine doing a crossword puzzle just called and asked me if I knew a seven letter word such that the third letter is h and the fifth letter is u. I replied exhaust, but that wasn’t correct. Find all such words
第二,Estimate the probability that in a group of 25 people, at least two of them share a birthday. Hint: Simulate a 365-sided die and roll it 25 times. Check if at least two of the values match. Then repeat this process 10,000 times and find the proportion of outcomes that have at least two values matching.
第三,Find all words that are palindromes. Note that a palindromic word is spelled the same in reverse as forwards (e.g., radar). Hint: is there a string function that reverses strings?
谢谢大家!!~!!~ 十分感谢!~~!~!~作者: shiyiming 时间: 2009-3-4 11:01 标题: Re: 求助!!! waiting for others' answer too.
i wonder if sas can resolve such problems.作者: shiyiming 时间: 2009-3-4 22:02 标题: Re: 求助!!! the first:没看错的话应该是用通配符
data a;
input s $ @@;
cards;
rahaua aaaaas
;
run;
data a;
set a;
where s like "__h_u__";
run;
the third:
data a;
input s $ @@;
if s=reverse(trim(s));
cards;
radar aaas
;
run;
the second:?if p=none of them share a birthday,the probability is equal to 1-p. <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: -->
其实把那个Hint 看明白了就应该没什么问题了作者: shiyiming 时间: 2009-3-5 03:04 标题: Re: 求助!!! 能帮我写一个code,我可以参考一下么? 谢谢啊!~作者: shiyiming 时间: 2009-3-5 03:18 标题: Re: 求助!!! 第一个题,我倒入数据库之后,run了一下, 符合规定,但是所有符合这个条件的单词都在里面,题目要求只要7个字母组成的这种单词,用什么code可以解决这个问题?作者: shiyiming 时间: 2009-3-5 18:03 标题: Re: 求助!!! 加一个length(s)=7;之前的会把只有5、6位的满足条件的都考虑进来,这个我没考虑周全 <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( -->