Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
130084 huangyifeng2 字母概率 C++ Output Limit Exceeded 21 MS 280 KB 434 2025-09-07 15:44:44

Tests(0/1):


Code:

#include<iostream> #include<string> #include<cctype> using namespace std; int main() { string str; char ch; int num = 0; while (true) { cin >> ch >> str; int a = str.length(); for (int i = 0; i < a; i++){ if (ch == str[i] || toupper(ch) == str[i]) { num++; } } cout << (float)num / a << endl; } }