HDU2734(简单题)
2014-12-09 09:16
295 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2734
解题思路:
用isupper判断是否为大写字母,如果是,那对应相乘再相加,否则略过。
完整代码:
解题思路:
用isupper判断是否为大写字母,如果是,那对应相乘再相加,否则略过。
完整代码:
#include <functional> #include <algorithm> #include <iostream> #include <fstream> #include <sstream> #include <iomanip> #include <numeric> #include <cstring> #include <climits> #include <cassert> #include <complex> #include <cstdio> #include <string> #include <vector> #include <bitset> #include <queue> #include <stack> #include <cmath> #include <ctime> #include <list> #include <set> #include <map> using namespace std; #pragma comment(linker, "/STACK:102400000,102400000") typedef long long LL; typedef double DB; typedef unsigned uint; typedef unsigned long long uLL; /** Constant List .. **/ //{ const int MOD = int(1e9)+7; const int INF = 0x3f3f3f3f; const LL INFF = 0x3f3f3f3f3f3f3f3fLL; const DB EPS = 1e-9; const DB OO = 1e20; const DB PI = acos(-1.0); //M_PI; string s; int main() { #ifdef DoubleQ freopen("in.txt","r",stdin); #endif while(getline(cin , s)) { if(s == "#") break; int len = s.length(); LL sum = 0; for(int i = 0 ; i < len ; i ++) { if(isupper(s[i])) sum += (i + 1) * (s[i] - 'A' + 1); } cout << sum << endl; s = ""; } }
相关文章推荐
- J2EE技术简单介绍
- 教学项目之-通过Python实现简单的计算器
- 不使用ATL向导,创建一个简单的ATL对话框程序.
- MySql实现简单的注册登录(易语言)
- PHP面向对象的使用教程 简单数据库连接
- 网页设计之5种简单的XHTML网页表单
- Dephi 程序输入法自动切换最简单最好用的实现方法(被程序员杂志采纳,重新详细整理)
- 一个简单的计数器程序
- 一个简单的投票程序
- 初学者看过来:简单谈谈 C/C++ 递归的思想,实现,以及和循环的关系。
- 一个简单地vb开发多媒体播放器软件的方法 适用初学者 mci
- 简单的留言板,解决了长英文字符的问题哦,不过汉字又出问题了:)希望大家一起来解决
- 邮件客户端程序的简单开发
- 在 VB 中简单使用 HTMLHELP (*.chm) 帮助
- 简单的Winsock例程
- JBuilder下调试java程序最简单的例子
- 用pascal写的最简单的winsock程序
- 一个简单的Proxy代理服务器的源代码!
- 简单模板概念
- 关于fvwm2的简单配置