HDU 4464 Browsing History(最大ASCII的和)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HDU 4464 Browsing History(最大ASCII的和)相关的知识,希望对你有一定的参考价值。

题目链接: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.
 
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
php?

field=problem&key=2012+Asia+Chengdu+Regional+Contest+&source=1&searchmode=source" style="color:rgb(26,92,200); text-decoration:none">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;
}


以上是关于HDU 4464 Browsing History(最大ASCII的和)的主要内容,如果未能解决你的问题,请参考以下文章

问题解决Selenium——NoSuchWindowException: Browsing context has been discarded

bzoj 4464 : [Jsoi2013]旅行时的困惑

shell下的history如何清除

history历史命令

window.history

history.back()