Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
24819 | 纪哲弘 | 字母概率 | C++ | Accepted | 9 MS | 764 KB | 297 | 2022-04-10 17:27:31 |
#include<iostream> #include<cstring> #include<cmath> using namespace std; int main(){ string a; char c; double b; while(cin>>c>>a){ for(int i=0;i<a.size();i++){ if(a[i]==c||a[i]==c+32||a[i]==c-32){ b++; } } printf("%.5lf\n",b/a.size()); b=0; } return 0; }