April Fools Day Contest 2016 C. Without Text 信号与系统
C. Without Text
题目连接:
http://www.codeforces.com/contest/656/problem/C
Description
You can preview the image in better quality by the link: http://assets.codeforces.com/files/656/without-text.png
Input
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
Codeforces
Sample Output
-87
Hint
题意
给你一个信号系统,然后问你输出是啥
题解:
还好我专业课是信号与系统,没事儿干就看这种图片……
模拟模拟就好了
代码
#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;
}
April Fools Day Contest 2016 C. Without Text 信号与系统的更多相关文章
- April Fools Day Contest 2016 D. Rosetta Problem
D. Rosetta Problem 题目连接: http://www.codeforces.com/contest/656/problem/D Description ++++++++[>+& ...
- April Fools Day Contest 2016 G. You're a Professional
G. You're a Professional 题目连接: http://www.codeforces.com/contest/656/problem/G Description A simple ...
- April Fools Day Contest 2016 F. Ace It!
F. Ace It! 题目连接: http://www.codeforces.com/contest/656/problem/F Description Input The only line of ...
- April Fools Day Contest 2016 E. Out of Controls
E. Out of Controls 题目连接: http://www.codeforces.com/contest/656/problem/E Description You are given a ...
- April Fools Day Contest 2016 B. Scrambled
B. Scrambled 题目连接: http://www.codeforces.com/contest/656/problem/B Description Btoh yuo adn yuor roo ...
- April Fools Day Contest 2016 A. Da Vinci Powers
A. Da Vinci Powers 题目连接: http://www.codeforces.com/contest/656/problem/A Description The input conta ...
- CF #April Fools Day Contest 2016 E Out of Controls
题目连接:http://codeforces.com/problemset/problem/656/E 愚人节专场的E,整个其实就是个Floyd算法,但是要求代码中不能包含 definedoforfo ...
- April Fools Day Contest 2014
April Fools Day Contest 2014 A.C.H三道题目 ============================================================= ...
- 坑爹CF April Fools Day Contest题解
H - A + B Strikes Back A + B is often used as an example of the easiest problem possible to show som ...
随机推荐
- SQLite3 C/C++ 开发接口简介(API函数)
from : http://www.sqlite.com.cn/MySqlite/5/251.Html 1.0 总览 SQLite3是SQLite一个全新的版本,它虽然是在SQLite 2.8.13的 ...
- MariaDB配置远程访问权限
首先配置允许访问的用户,采用授权的方式给用户权限 1 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRAN ...
- Vim文本编辑命令
Vim Vim是一个类似于Vi的著名的功能强大.高度可定制的文本编辑器,在Vi的基础上改进和增加了很多特性.[1] VIM是自由软件. Vim普遍被推崇为类Vi编辑器中最好的一个,事实上真正的劲敌来 ...
- js基础练习(四)
练习: 通过循环按行顺序为一个5×5的二维数组a赋1到25的自然数,然后输出该数组的左下半三角.试编程. 2 3 4 5 6 7 8 9 10 11 12 13 14 ...
- 洛谷 P2077 红绿灯 题解
题目传送门 这道题一秒一秒的扫描一定会超时,所以就用一种O(N)的算法. #include<bits/stdc++.h> using namespace std; ],b[],c[],x= ...
- 【LOJ】#2085. 「NOI2016」循环之美
题解 我们要求的其实是这个东西= = \(\sum_{i = 1}^{n}\sum_{j = 1}^{n}[(i,j) == 1][(j,k) == 1]\) 然后变一下形 \(\sum_{j = 1 ...
- HttpServletRequest继承字ServletRequest的常用方法
//获取请求的完整路径String origUrl = req.getRequestURL().toString(); //获取查询的参数String queryStr = req.getQueryS ...
- Laravel 之父:让 Laravel、Symfony、 Zend 来一场公平的性能测试
网上充斥着各式各样的 PHP 框架性能对比的文章.然而,他们总是把“苹果”和“橘子”做对比(看上去有点儿像,都是圆的,但其实不是一码事).这次,我将着重对 Laravel.Symfony 和 Zend ...
- CodeForces 785B Anton and Classes
简单判断. 找第一类区间中$R$最大的,以及第二类区间中$L$最小的,判断距离. 找第二类区间中$R$最大的,以及第一类区间中$L$最小的,判断距离. 两种情况取个最大值即可. #include &l ...
- 隐马尔可夫模型(Hidden Markov Model)
隐马尔可夫模型(Hidden Markov Model) 隐马尔可夫模型(Hidden Markov Model, HMM)是一个重要的机器学习模型.直观地说,它可以解决一类这样的问题:有某样事物存在 ...