HDU 4464 Browsing History(最大ASCII的和)
来源:互联网 发布:贵州华为大数据学院 编辑:程序博客网 时间:2024/05/18 00:29
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4464
Problem Description
One day when you are going to clear all your browsing history, you come up with an idea: You want to figure out what your most valued site is. Every site is given a value which equals to the sum of ASCII values of all characters in the URL. For example aa.cc has value of 438 because 438 = 97 + 97 + 46 + 99 + 99. You just need to print the largest value amongst all values of sites.
Things are simplified because you found that all entries in your browsing history are of the following format: [domain], where [domain] consists of lower-case Latin letters and “.” only. See the sample input for more details.
Things are simplified because you found that all entries in your browsing history are of the following format: [domain], where [domain] consists of lower-case Latin letters and “.” only. See the sample input for more details.
Input
There are several test cases.
For each test case, the first line contains an integer n (1 ≤ n ≤ 100), the number of entries in your browsing history.
Then follows n lines, each consisting of one URL whose length will not exceed 100.
Input is terminated by EOF.
For each test case, the first line contains an integer n (1 ≤ n ≤ 100), the number of entries in your browsing history.
Then follows n lines, each consisting of one URL whose length will not exceed 100.
Input is terminated by EOF.
Output
For each test case, output one line “Case X: Y” where X is the test case number (starting from 1) and Y is a number indicating the desired answer.
Sample Input
1aa.cc2www.google.comwww.wikipedia.org
Sample Output
Case 1: 438Case 2: 1728
Source
2012 Asia Chengdu Regional Contest
题意:
求最大的ASCII的和!
代码如下:
#include <cstdio>#include <cstring>int main(){ int cas = 0; int n; char s[117]; while(~scanf("%d",&n)) { getchar(); int maxx = 0; int sum = 0; for(int i = 0; i < n; i++) { gets(s); sum = 0; int len = strlen(s); for(int j = 0; j < len; j++) { sum += s[j]; } if(sum > maxx) maxx = sum; } printf("Case %d: %d\n",++cas,maxx); } return 0;}
1 0
- HDU 4464 Browsing History(最大ASCII的和)
- hdu 4464 Browsing History
- hdu 4464 Browsing History
- Hdu 4464 Browsing History
- HDU-#4464 Browsing History
- HDU 4464 Browsing History
- HDU 4464 Browsing History
- HDU—— 4464 Browsing History
- HDU-4464-Browsing History (2012 ACM/ICPC成都现场赛!)
- Browsing History
- A - Browsing History
- 2012ACM/ICPC成都赛区现场赛A题---Browsing History(hdu4464)
- history.back()和history.go()的区别
- history.back()和history.go()的区别
- 2012ICPC长春站 A Browsing History 【字符串】
- history命令保存的最大数
- history命令保存的最大数?
- 1003(hdu-最大和)
- 多线程的技术总结
- 用链表实现队列的操作
- 笔记80--android中的分辨率和屏幕密度,获取屏幕大小
- Python字典高级使用方法汇总
- Node.js 爬虫批量下载美剧 from 人人影视 HR-HDTV
- HDU 4464 Browsing History(最大ASCII的和)
- Linux网络基础配置
- Google protobuf使用之proto文件编写规则(二)
- 二. 使用VS2012 Addin参考项目(文件查找项目)
- weblogic绿色版安装
- wincc7.2安装授权的时候,该安装哪些?
- 软件工程——软考探究(三)
- VM Depot 镜像新增系列II – 学习管理系统,内容管理系统以及平台管理工具
- Activity切换效果