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 ...
随机推荐
- Day4:T1小技巧(类似于指针操作)T2搜索+小细节
Day4:其中有很多小技巧get T1 一直没有听到过像这样的小技巧的略专业名词,有点类似于指针操作,之前有碰到过很多这样的题目 每次都是以不同的形式出现,但是感觉思想还是有点接近的吧(就比如某天有一 ...
- 2013集训.DAY1.A
发现自己漏整理了一套,现在附上T1:primenumT2:sendroseT4:warfare除了第一题以外,其余的两题由于当时太弱什么都不会,所以用来学习....T2 SPFA T4 最大生成树
- C#中字符转换问题详解
C# 出来也有些日子了,最近由于编程的需要,对 C# 的类型转换做了一些研究,其内容涉及 C# 的装箱/拆箱/别名.数值类型间相互转换.字符的 ASCII 码和 Unicode 码.数值字符串和数值之 ...
- linux学习心得之目录树开端与/etc(图文)
linux学习心得之目录树开端与/etc(图文) linux中“一切皆文件”,学习linux一年了,在学习过程中对目录树的一点心得,分享给大家,有不对的地方敬请斧正. 不多说了,先上图: 根目录: / ...
- iOS 开发之协议-代理传值
刚开始做iOS开发的时候,对 protocol.delegate 的理解一直都是晕晕乎乎一知半解的状态,不知道两个UIViewController之间怎么进行传值. 面试过几个童鞋,问道怎么用 del ...
- CLR_Via_C#事件
CLR_Via_C#学习笔记之事件 一:首先我先引用网上别人对事件的一些说明,然后将会通过一个事例进行对事件的演示: EventArgs是包含事件数据的类的基类,用于传递事件的细节.EventHa ...
- Winform常用开发模式第一篇
Winform常用开发模式第一篇 上一篇博客最后我提到“异步编程模型”(APM),之后本来打算整理一下这方面的材料然后总结一下写篇文章与诸位分享,后来在整理的过程中不断的延伸不断地扩展,发现完全偏离了 ...
- 使用Struts2实现文件的上传和下载
(一)单个文件的上传步骤: 1.拷贝jar包:commons-fileupload.jar, commons-io.jar 下载链接(文件上传.rar):http://www.cnblogs.com ...
- GestureDetector学习之左右滑动,上下滑动屏幕切换页面
要实现滑屏等触发事件,视情况而定: 如果实现的触屏或者手势效果较多,则使用第一种方法,实现OnGestureListener 接口(参考OnGestureListener): 如果只是实现较少的效果, ...
- linux apt-get 源配置
linux中apt-get不能使用可能因为源不对,需要修改/etc/apt下的sources.list文件 apt-get源网上有很多,但是试了很多都不能用,以下提供一个我自己这边使用成功的源: de ...