HDU------checksum
Quicksum |
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) |
Total Submission(s): 3401 Accepted Submission(s): 2095 |
Problem Description
A checksum is an algorithm that scans a packet of data and returns a single number. The idea is that if the packet is changed, the checksum will also change, so checksums are often used for detecting transmission errors, validating document contents, and in many other situations where it is necessary to detect undesirable changes in data.
For this A Quicksum is the sum of the products of ACM: 1*1 + 2*3 + |
Input
The input consists of one or more packets followed by a
line containing only # that signals the end of the input. Each packet is on a line by itself, does not begin or end with a space, and contains from 1 to 255 characters. |
Output
For each packet, output its Quicksum on a separate line
in the output. |
Sample Input
ACM |
Sample Output
46 |
Source
Mid-Central USA 2006
|
Recommend
teddy
|
#include <string.h>
#include <stdio.h> int main()
{
char str[];
int len,i,a[],sum;
for(i = ;i<;i++)
{
a[i] = i+;
}
while(gets(str))
{
if(strcmp(str,"#") == )
break;
len = strlen(str);
sum = ;
for(i = ;i<len;i++)
{
if(str[i]>='A' && str[i]<='Z')
sum+=(i+)*a[str[i]-'A'];
}
printf("%d\n",sum);
} return ;
}
HDU------checksum的更多相关文章
- HDU 5536 Chip Factory 字典树
Chip Factory Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid= ...
- hdu 5536 Chip Factory (01 Trie)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=5536 题面; Chip Factory Time Limit: 18000/9000 MS (Java/O ...
- HDU.2734 Quicksum
Quicksum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Subm ...
- HDU 5536 Chip Factory 【01字典树删除】
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=5536 Chip Factory Time Limit: 18000/9000 MS (Java/Ot ...
- PE Checksum Algorithm的较简实现
这篇BLOG是我很早以前写的,因为现在搬移到CNBLOGS了,经过整理后重新发出来. 工作之前的几年一直都在搞计算机安全/病毒相关的东西(纯学习,不作恶),其中PE文件格式是必须知识.有些PE文件,比 ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
随机推荐
- SpringMVC格式化显示
SpringMVC学习系列(7) 之 格式化显示 在系列(6)中我们介绍了如何验证提交的数据的正确性,当数据验证通过后就会被我们保存起来.保存的数据会用于以后的展示,这才是保存的价值.那么在展示的时候 ...
- SZU:G32 Mass fraction
Judge Info Memory Limit: 32768KB Case Time Limit: 5000MS Time Limit: 5000MS Judger: Float Numbers (1 ...
- Linux普通文件和设备的异同点
众所周知,Linux下一切皆文件,文件包含数据,具有属性,通过目录中的名字被标识,可以从一个文件读取数据,写入另一个文件,而Linux把这写应用于设备. 请看如下普通文件和设备的对比:
- DOM(一)
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- Azure的两种关系型数据库服务:SQL Azure与SQL Server VM的不同
Azure的两种关系型数据库服务:SQL Azure与SQL Server VM的不同 <Windows Azure Platform 系列文章目录> 如果熟悉Windows Azure平 ...
- Controller 和 Action (2)
Controller 和 Action (2) 继上一篇文章之后,本文将介绍 Controller 和 Action 的一些较高级特性,包括 Controller Factory.Action Inv ...
- PHP gbk转换成utf8
/** * GBK ASCII 转换成utf8 */ public function to_utf8($str){ $detect = array('ASCII', 'GBK', 'UTF-8'); ...
- 企业架构研究总结(45)——企业架构与建模之使用ArchiMate进行分析(全系列完)
4. 使用ArchiMate进行分析 正如前面所说的那样,一个企业整体效率的提升有时并不是通过某一个领域内的优化就能达到的,而且这种忽视全局的做法往往还会造成不必要的浪费.由此可见,一个能够跨越各个领 ...
- DOM处理
DOM处理 这几天整理了一下思路,本来觉得DOM部分会有很多东西,但是忽然发现频繁使用的其实并不太多 class class处理部分主要有四个 hasClass:检查元素是否包含某个class add ...
- springMVC3学习(十二)--文件上传优化CommonsMultipartResolver
基于上一篇文件上传发现效率很慢,我们应该对它进行优化 使用springMVC对文件上传的解析器 来处理文件上传的时候需要在spring的applicationContext里面加上springMVC ...