Browsing History

时间:2023-03-09 07:32:09
Browsing History

hdu4464:http://acm.hdu.edu.cn/showproblem.php?pid=4464

题意:就是统计n个字符串中每个字符串每个字符对印的Asci,然后输出最大的长度。

题解:水题,注意一个技巧:字符对应的asci 直接int a=(int )c(c是字符类型即可)。

 #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char str[];
int main(){
int tt=,n,ans=,temp;
while(~scanf("%d",&n)){
ans=;
while(n--){
memset(str,,sizeof(str));
scanf("%s",str);
int len=strlen(str);
temp=;
for(int i=;i<len;i++){
temp+=(int)str[i];
}
ans=max(ans,temp);
}
printf("Case %d: %d\n",tt++,ans); }
}