0711华为机试-名字的漂亮度
来源:互联网 发布:网页视频下载软件 编辑:程序博客网 时间:2024/05/17 08:58
坑爹的机试题,题很容易,线下通过,线上调试了很久,最后还是通过了
#include<iostream>#include<vector>#include<string>#include<cctype>#include<algorithm>using namespace std;int main(){ int n; string str; while (cin>>n) { while (n--) { cin >> str; vector<int>a(26, 0); int count = 0; for (int i = 0; i < (int)str.size(); ++i) { if (isupper(str[i])) a[str[i] - 'A' + 0]++; else a[str[i] - 'a' + 0]++; } int x = 26; sort(a.begin(), a.end()); for (int i = 25; i >= 0; i--) if (a[i]) count += a[i] * x--; cout << count << endl; } } return 0;}
阅读全文
0 0
- 华为机试:名字的漂亮度
- 华为机试-名字的漂亮度
- 0711华为机试-名字的漂亮度
- 华为机试—名字的漂亮度
- [华为机试练习题]38.名字的漂亮度
- 华为机试——名字的漂亮度
- 华为oj-名字的漂亮度
- 华为OJ测试--名字的漂亮度
- 华为OJ 名字的漂亮度
- 华为OJ 名字的漂亮度
- 华为oj:名字的漂亮度
- 华为oj_名字的漂亮度
- 华为oj名字的漂亮度
- 华为OJ:名字的漂亮度
- 华为OJ-名字的漂亮度
- 华为OJ 名字的漂亮度
- 【华为OJ】【033-名字的漂亮度】
- [华为OJ] 名字的漂亮度
- html页面框架布局
- 二维数组的查找
- Linux指令-与文件访问权限有关的指令(第一天)
- 2017.7.11 && 一些不熟悉的函数 && 一些干货学习资料
- 关系数据库事务隔离级别
- 0711华为机试-名字的漂亮度
- GO语言flag参数解析
- Struts2升级版本至2.5.10,高危漏洞又来了
- HTTP1.0 HTTP 1.1 HTTP 2.0主要区别
- linux面试准备2
- SharedPreference.Editor的apply和commit方法异同
- HashMap,LinkedHashMap,TreeMap
- 触屏拖动
- u盘安装ubuntu看不到机械硬盘,可以看到SSD