Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
151656 Kevin 字母概率 C++ Accepted 5 MS 276 KB 374 2026-04-17 10:28:07

Tests(1/1):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ string a; char b; while(cin>>b>>a){ int len=a.size(); if(b>='A'&&b<='Z') b=b+32; for(int j=0;j<len;j++){ if(a[j]>='A'&&a[j]<='Z'){ a[j]=a[j]+32; } } int s=0; for(int j=0;j<len;j++){ if(a[j]==b){ s++; } } printf("%.5lf\n",double(s)/len); } return 0; }