2 条题解
-
1
不信你试试
print('''0.04965 0.05181 0.04274 0.05172 0.12821 0.02804 0.02128 0.00000 0.00000 0.06250 0.03049 0.01136 0.07547 0.02614 0.04545 0.06349 0.01266 0.05172 0.04118 0.07547 0.02817 0.04730 0.05263 0.00000 0.04891 0.04545 0.03030 0.02247 0.04969 0.05051 0.05051 0.06780 0.05085 0.02381 0.02878 0.06349 0.07216 0.01613 0.02222 0.06250 0.05000 0.03145 0.05229 0.04569 0.04938 0.02424 0.00000 0.00000 0.00000 0.03448 0.03175 0.03306 0.04587 0.00000 0.07576 0.04000 0.04839 0.06250 0.02941 0.06098 0.04386 0.01974 0.04000 0.00000 0.04110 0.04895 0.03571 0.00000 0.04520 0.03333 0.02778 0.00000 0.04571 0.02516 0.03540 0.05185 0.05143 0.04310 0.08475 0.00000 0.04286 0.07971 0.03571 0.05556 0.02000 0.05882 0.03448 0.03509 0.02591 0.04225 0.05172 0.05263 0.04598 0.07979 0.00000 0.01835 0.01863 0.05405 0.03759 0.09155 ''')
-
0
没好的一天~~~
#include <bits/stdc++.h> using namespace std; int shift(string s, char c) { int num = 0; char a = ' '; if(c >= 'a' and c <= 'z') { a = c - 32; } else if(c >= 'A' and c <= 'Z') { a = c + 32; } for(int i = 0; i < s.length(); i++) { if(s[i] == c or s[i] == a) { num++; } } return num; } int main() { int n; cin >> n; string s; char c; for(int i = 1; i <= n; i++) { cin >> c >> s; cout << fixed << setprecision(5) << 1.0 * shift(s, c) / s.length() << endl; } return 0; }
- 1
信息
- ID
- 1009
- 时间
- 1000ms
- 内存
- 32MiB
- 难度
- 7
- 标签
- 递交数
- 32
- 已通过
- 10
- 上传者