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

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;
}
时间: 2024-08-14 11:26:04

HDU 4464 Browsing History(最大ASCII的和)的相关文章

Browsing History

hdu4464:http://acm.hdu.edu.cn/showproblem.php?pid=4464 题意:就是统计n个字符串中每个字符串每个字符对印的Asci,然后输出最大的长度. 题解:水题,注意一个技巧:字符对应的asci 直接int a=(int )c(c是字符类型即可). 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 u

hdu 4464 水

http://acm.hdu.edu.cn/showproblem.php?pid=4464 现场赛总会有水题,这就是最水的一道,估计也就是能当高校的上机题,保研用,呵呵~~~ #include <cstdio> #include <cstring> #include <iostream> using namespace std; #define ll long long const int MAXN= 100+20; char s[MAXN]; int main()

Delete Browsing History for IE 1.0

IE11.bat 1 rundll32.exe inetcpl.cpl,ClearMyTracksByProcess Flags: 16640 2 rundll32.exe inetcpl.cpl,ClearMyTracksByProcess Flags: 18939 3 rundll32.exe inetcpl.cpl,ClearMyTracksByProcess Flags: 2304 4 rundll32.exe inetcpl.cpl,ClearMyTracksByProcess Fla

HDU-4464-Browsing History (2012 ACM/ICPC成都现场赛!)

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

最大ASCII的和问题

问题: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 ex

ASCII 码对应表

Macron symbol ASCII CODE 238 : HTML entity : [ Home ][ español ] What is my IP address ? your public IP address is: 118.163.184.243 ASCII control characters 00NULL(Null character) 01SOH(Start of Header) 02STX(Start of Text) 03ETX(End of Text) 04EOT(E

HDU4664

<span size="+0"><strong><span style="font-family:Arial;font-size:12px;color:green;font-weight: bold;">Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ubmission(s): 3088    Acc

HTTP协议 (七) Cookie

Cookie是HTTP协议中非常重要的东西, 之前拜读了Fish Li 写的[细说Cookie], 让我学到了很多东西.Fish的这篇文章写得太经典了. 所以我这篇文章就没有太多内容了. 最近我打算写一个系列的HTTP文章,我站在HTTP协议的角度, 说说我对Cookie的理解. 阅读目录 Cookie是什么,有什么用,为什么要用到Cookie Cookie的分类 Cookie存在哪里 使用和禁用Cookie Fiddler查看HTTP中的Cookie 网站自动登陆的原理 截获Cookie,冒充

Software List [Windows, Linux, Freebsd, Tools...]

Microsoft 下载管理器: 使用 Microsoft 下载管理器从 Internet下载文件比单独使用浏览器更可靠且速度更快, 支持多线程下载,多语言. http://www.microsoft.com/zh-cn/download/details.aspx?id=27960 Chrome 浏览器(完整包): https://www.google.com/chrome/browser/thankyou.html?standalone=1&platform=win Firefox火狐浏览器: