[hackerrank]The Love-Letter Mystery
https://www.hackerrank.com/contests/w3/challenges/the-love-letter-mystery
简单题。
#include <cstdlib>
#include <string>
#include <iostream> using namespace std; int main() {
int N;
cin >> N;
while (N--) {
string s;
cin >> s;
int count = 0;
int l = 0;
int r = s.size() - 1;
while (l < r) {
count += abs(s[l++] - s[r--]);
}
cout << count << endl;
}
return 0;
}
[hackerrank]The Love-Letter Mystery的更多相关文章
- 【HackerRank】The Love-Letter Mystery
James找到了他的朋友Harry要给女朋友的情书.James很爱恶作剧,所以他决定要胡搞一下.他把信中的每个单字都变成了回文.对任何给定的字符串,他可以减少其中任何一个字符的值,例如'd'可以变成' ...
- [LeetCode] Letter Combinations of a Phone Number 电话号码的字母组合
Given a digit string, return all possible letter combinations that the number could represent. A map ...
- 17. Letter Combinations of a Phone Number
题目: Given a digit string, return all possible letter combinations that the number could represent. A ...
- 什么是Unicode letter
起因:从一段代码说起 using System; using System.Collections.Generic; using System.Linq; using System.Text; usi ...
- LeetCode——Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent. A map ...
- 日常小测:颜色 && Hackerrank Unique_colors
题目传送门:https://www.hackerrank.com/challenges/unique-colors 感谢hzq大神找来的这道题. 考虑点分治(毕竟是路经统计),对于每一个颜色,它的贡献 ...
- No.017:Letter Combinations of a Phone Number
问题: Given a digit string, return all possible letter combinations that the number could represent.A ...
- SCI/EI期刊投稿 Reply Letter 常用格式总结
SCI/EI期刊投稿Reply Letter常用格式总结 整个论文投稿的过程中,会遇到各种问题,需要我们向主编询问或是回复.下面主要总结了responses to the comme ...
- 【leetcode】 Letter Combinations of a Phone Number(middle)
Given a digit string, return all possible letter combinations that the number could represent. A map ...
随机推荐
- 压缩html 减小存储空间
压缩html 减小存储空间 方法一.php代码,清除换行符,清除制表符,去掉注释标记 /** * 压缩html : 清除换行符,清除制表符,去掉注释标记 * @param $string * @ret ...
- Gulpfile.js——编译、压缩、合并js和css文件
gulp 一个入门教程:http://www.ydcss.com/gulp API文档地址:http://www.gulpjs.com.cn/docs/api/ 我的一个Low版的gulpfile v ...
- php读取图片内容并输出到浏览器的实现代码
如果php以图片,zip,exe等文件输出到浏览器,而前面还输出了其他字符,就会有乱码. 代码很简单,网上都能找到,但在我机子上就是显示不出来,显示出的一直是这个php文件路径,费了点时间才搞定,原来 ...
- Delphi 两个应用程序(进程)之间的通信
两个应用程序之间的通信实际上是两个进程之间的通信.由于本人知识有限,决定应用消息来实现.需要用到的知识: 1.RegisterWindowMessage(); //参数类型:pchar:返回值:Lon ...
- linux下查看进程内存使用情况
1. top命令--动态查看一个进程的内存使用top -d 1 -p pid [,pid ...] //设置为delay 1s,默认是delay 3s 如果想根据内存使用量进行排序,可以shift ...
- sublimetext2 中运行Python提示EOFError: EOF when reading a line
解决方法:一.安装sublimeREPL 打开sublimeText2按CTRL+SHIFT+P,英文版输入:install后选择Package Control: Install Package ...
- ASP.NET中利用Split实现对Checkbox的字符串分离放到DataTable里面
一.背景 昨天唐欢问了我一个问题: 现在有一个CheckBox和一个Label如下图: 要实现选中CheckBox,点击下面打印按钮的时候要做成这个样子的如下图: 简单的说就是档案编号作为表中的一个列 ...
- 将日志搬家到自己的站点 http://nowhereman.cn/
个人站点同步地址 : http://nowhereman.cn/
- ASP.NET MVC 学习第三天
今天来简单说一下Razor视图引擎语法相关的和视图类. 添加一个MvcTest项目,继续添加一个Home控制器,完成index的视图添加.我们就在index这里分析razor视图引擎.下面是home控 ...
- 对象图 Object Diagram
一.用一张图来介绍一下对象图的基本内容 二.对象图与类图的基本区别 三.对象图实例