hdu4464
来源:互联网 发布:unity3d导入fbx动画 编辑:程序博客网 时间:2024/05/17 17:44
Browsing History
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3338 Accepted Submission(s): 1878
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
#include <stdio.h>#include <string.h>main (){ int n,i,l,t=1,sum,max; char s[105]; while (scanf ("%d\n",&n)!=EOF) { max=0; while (n--) { sum=0; gets(s); l=strlen(s); for (i=0;i<l;i++) sum+=s[i]; if (sum>max) max=sum; } printf ("Case %d: %d\n",t++,max); }}
0 0
- hdu4464
- hdu4464
- 2012ACM/ICPC成都赛区现场赛A题---Browsing History(hdu4464)
- setObject:ForKey:与setValue:ForKey:的区别与联系
- JS实现页面超时后自动跳转到登陆页面
- 滚动屏幕加载信息
- java-错误 java.lang.NoClassDefFoundError: org/apache/log4j/Level
- 详解结构体、类等内存字节对齐
- hdu4464
- Frame和bounds,clipsToBounds和masksToBounds
- 一个比喻
- Linux进程间通信之消息队列(一)
- 动态加载当前屏幕的网页图片(网页拖动时图片加载显示)
- CPCI
- git@ubuntu-start!
- 如何才能让自己更有魅力
- 怎么样保存奔溃后activity中的数据