程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> HDU-4464-Browsing History (2012 ACM/ICPC成都現場賽!)

HDU-4464-Browsing History (2012 ACM/ICPC成都現場賽!)

編輯:C++入門知識

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 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 
#include 
#include 
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; ians) ans = tmp;
		}
		printf("Case %d: %d\n", k++, ans);
	}
	return 0;
}



  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved