Browsing History


1000ms
1000ms
32768KB
64-bit integer IO format: %I64d      Java class name: Main
Font Size:   
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


题意概述:意思很简单,题目也很简单,之所以写这篇博客是因为想保持每日一篇博客的记录。

解题思路:没什么值得说的,简单的运算就可以了。

源代码:

#include<iostream>
#include<string>
using namespace std;
int main()
{
    string S;
    int T,sum,R,num=1;
    while(cin>>T&&T)
    {
         R=0; 
         while(T--)
         {
                   sum=0;
                   cin>>S;
                   for(int i=0;i<S.size();++i)sum+=S[i];
                   if(R<sum)R=sum;
         }
         cout<<"Case "<<num<<": "<<R<<endl;
         num++;
    }
    return 0;
} 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值