2013
12-29

# Probability

Mickey is interested in probability recently. One day , he played a game which is about probability with mini.First mickey gives a letter and a word to mini.Then mini calculate the probability that the letter appears in the word.For example,give you the letter "a" and the word "apple". the probability of this case is 0.20000.

The input contains several test cases. Each test case consists of a letter and a word.The length of the word is no longer than 200.

The input contains several test cases. Each test case consists of a letter and a word.The length of the word is no longer than 200.

a apple
c Candy
a banana

0.20000
0.20000
0.50000

（1）：

while(scanf("%c",&a)!=EOF)
{
getchar();
scanf("%s",str);
getchar();
}

（2）：

while(scanf(" %c",&a)!=EOF)
{
scanf("%s",str);
}

（3）：

while(scanf("%c ",&a)!=EOF)
{
scanf("%s\n",str);
}

/*************
HDU 2131.cpp
Author:souly

http://blog.csdn.net/aiyi21

Time：2013.8.5
*************/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
int main()
{
freopen("in.txt","r",stdin);
int i,j,len,sign;
char a,str[205];
while(scanf("%c ",&a)!=EOF)
{
// getchar();
scanf("%s\n",str);
//getchar();
sign=0;
len=strlen(str);
char b=(a>='A'&&a<='Z')?a+32:a-32;
for(i=0;i<len;i++)
{
if(str[i]==a||str[i]==b)
sign++;
}
double sum=double(sign)/len;
printf("%0.5lf\n",sum);
}
return 0;
}

1. 其实国内大部分公司对算法都不够重视。特别是中小型公司老板根本都不懂技术，也不懂什么是算法，从而也不要求程序员懂什么算法，做程序从来不考虑性能问题，只要页面能显示出来就是好程序，这是国内的现状，很无奈。

2. Often We don’t set up on weblogs, but I would like to condition that this established up really forced me individually to do this! considerably outstanding publish