April Fools Day Contest 2016 C. Without Text 信号与系统
2016-04-02 19:22
330 查看
C. Without Text
题目连接:
http://www.codeforces.com/contest/656/problem/CDescription
You can preview the image in better quality by the link: http://assets.codeforces.com/files/656/without-text.pngInput
The only line of the input is a string (between 1 and 50 characters long, inclusive). Each character will be an alphanumeric character or a full stop ".".Output
Output the required answer.Sample Input
CodeforcesSample Output
-87Hint
题意
给你一个信号系统,然后问你输出是啥题解:
还好我专业课是信号与系统,没事儿干就看这种图片……模拟模拟就好了
代码
#include<bits/stdc++.h> using namespace std; string s; int id(char c) { if(c>='A'&&c<='Z')return c-'A'+1; if(c>='a'&&c<='z')return c-'a'+1; } int main() { long long res = 0; cin>>s; for(int i=0;i<s.size();i++) { char a1 = '@'; char a2 = '['; char a3 = '`'; char a4 = '{'; int flag1 = (a1<s[i])&(a2>s[i]); int flag2 = (a3<s[i])&(a4>s[i]); res = res + (flag1*id(s[i]))-(flag2*id(s[i])); } cout<<res<<endl; }
相关文章推荐
- js设计模式-组合模式
- python基本文件操作(文件输入和输出)
- Android客户端性能优化(魅族资深工程师毫无保留奉献)
- 【dancing links】hust1017
- 分类模型的性能评估——以SAS Logistic回归为例(1): 混淆矩阵
- Java---设计模块(单例的变形)(多例)
- Chrome 插件JSONView改变风格
- Java---设计模块(单例的变形)(多例)
- 作业五
- Opengl教程之 读取obj并绘制在picturecontrol控件内
- Spring 源码分析(四) ——MVC(六)M 与 C 的实现
- python 调用C++模块 visual studio版
- linux 配置 Samba 服务器实现文件共享
- [Commons]——集合操作
- 【CodeForces】610B - Vika and Squares(模拟)
- 一个普通程序员的中国梦
- Android Activity经常被自动回收
- Spring 源码分析(四) ——MVC(五)初始化阶段
- 【DP】poj1722
- iOS自定义显示30天日历