Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
151300 陈棋 字母概率 C++ Accepted 5 MS 280 KB 296 2026-04-11 16:04:41

Tests(1/1):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ char c; string s; while(cin>>c>>s){ char tar=tolower(c); int cnt=0; int len=s.size(); for(char ch : s){ if(tolower(ch)==tar){ cnt++; } } double p=1.0*cnt/len; printf("%.5f\n",p); } return 0; }