HDU-4464-Browsing History (2012 ACM/ICPC成都现场赛!)
2014-11-26 20:42
357 查看
Browsing History
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3065 Accepted Submission(s): 1692
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.
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.
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
1 aa.cc 2 www.google.com www.wikipedia.org
Sample Output
Case 1: 438 Case 2: 1728
Source
2012 Asia Chengdu Regional Contest
水题不解释....
AC代码:
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; int main() { int n, k = 1; char a[105]; while(~scanf("%d", &n)) { int ans=0; n--; scanf("%s", a); for(int i=0; i<strlen(a); i++) { ans+=a[i]; } while(n--) { scanf("%s", a); int tmp = 0; for(int i = 0; i<strlen(a); i++) { tmp += a[i]; } if(tmp>ans) ans = tmp; } printf("Case %d: %d\n", k++, ans); } return 0; }
相关文章推荐
- hdu 4472 Count (2012 ACM-ICPC 成都现场赛)
- HDU-4472-Count (2012 ACM/ICPC成都现场赛)
- hdu 4472 Count (2012 ACM-ICPC 成都现场赛)
- hdu 4465 Candy(2012 ACM-ICPC 成都现场赛)
- hdu 4465 Candy(2012 ACM-ICPC 成都现场赛)
- 2012 ICPC/ACM 成都现场赛 Candy
- hdu 4473 Exam (2012ACM成都赛区现场赛J题)
- 【数学期望】【2012 ACM/ICPC 成都赛区现场赛】【B.Candy】
- 【DP】【2012 ACM/ICPC 成都赛区现场赛】【I.Count】
- HDU 4790 2013 ACM/ICPC 成都赛区现场赛 J. Just Random
- 2012ACM/ICPC成都赛区现场赛A题---Browsing History(hdu4464)
- HDU 4790 Just Random (2013ACM/ICPC成都赛区现场赛J题)
- 2012 ACM/ICPC 成都赛区网络赛 HDU 4296
- 2012ACM/ICPC成都赛区现场赛I题---Count(hdu4472)
- ACM/ICPC 2012金华regional现场赛C题 hdu4444 离散化、最短路
- 2012 ACM/ICPC 杭州赛区 A题 HDU 4453 Looploop 伸展树
- ACM/ICPC 2012 天津 - HDU 4433 - DP(顺推)
- HDU 4455 Substrings 第37届ACM/ICPC 杭州赛区现场赛 C题 (DP)
- hdu 4444 Walk【2012 ACM/ICPC 金华区域赛C题】
- Hdu 4035 Maze (dp求期望) - 2011 ACM/ICPC 成都赛区网络预选赛 1005