TOJ 3758: The value of poetry
来源:互联网 发布:知乎回答排名规则 编辑:程序博客网 时间:2024/06/05 21:55
3758: The value of poetry
描述
"When I was down beside the sea,
A wooden spade they gave to me
To dig the sandy shore
The holes were empty like a cup ... "
Bob is a little boy who began to study english. Every day, his teacher will guide them read one or more poetries loudly though they don't understand the meaning of the poetries. But it seems that it doesn't affect Bob enthusiasm of learning english. Because he has his own standard to evaluate a poetry. A letter's order in alphabet is his value no matter lowercase or uppercase and punctuations, digits and spaces' value will be ignored.
Now, can you calculate the value of the poetry after Bob read it over?
输入
The input contains multiple test cases.(No more than 100)
Each case contains a poetry only with letters, spaces and punctuations.
The length of the poetry will not bigger than 10000.
输出
You should output one line with the value of poetry Bob read.
样例输入
HDOJ
A C M
"acm"
样例输出
37
17
17
代码
#include <stdio.h>#include <string.h>
int main()
{
char s[10001];
int i,l,a;
while(gets(s)&&s[0]!='\0')
{
a=0;
l=strlen(s);
for(i=0;i<l;i++)
{
if(s[i]>='a'&&s[i]<='z')
a=a+s[i]-96;
if(s[i]>='A'&&s[i]<='Z')
a=a+s[i]-64;
}
printf("%d\n",a);
}
return 0;
}
- TOJ 3758: The value of poetry
- 【每天读一点英文】The Poetry of Late Summer
- TOJ 10002 The Tower of Hanoi
- 【TOJ 1167】The Settlers of Catan【欧拉路】
- TOJ : 1794. The Bottom of a Graph
- The Value of Time
- the value of ESP...
- TOJ 1132 ZOJ 1090 The Circumference of the Circle
- Poetry and the Microphone
- The value of first company
- THE VALUE OF A SMILE
- TOJ 10007 The last non-zero digit of n!
- Sentiment After The Poetry Class
- The Value of Forums - Finding Forums
- About the return value of SetTimer function
- Modify the value of Dictionary in circle
- swap two value of the same type
- DLL 调用错误 -The value of ESP
- Java基础—常用DOS命令
- 37. Sudoku Solver
- 早绑定和晚绑定
- ReentrantLock可重入锁的原理及使用场景
- HDU 1978(动态规划)
- TOJ 3758: The value of poetry
- Java动态代理深度解析
- 12月16日 数据结构 周六
- 四元数姿态解算
- bzoj4349&2260 最小树形图(商店购物)(朱刘算法 最小树形图)
- 一款GIF录屏小软件
- Ubuntu中出现libz.so.1问题
- Kali Linux 下使用官网的 .tar.bz2压缩包 安装Sublime Text 3的方法
- 深入理解JavaScript运行机制