UVA458 - The Decoder
来源:互联网 发布:office激活软件 编辑:程序博客网 时间:2024/05/18 01:45
问题描述
输入多个字符串,经过某种变化后,输出相应字符串。
思路
比较输入和输出字符之间的ASCII码表,发现两个字符之间输入字符-7=输出字符。
代码
#include<iostream>#include<string>using namespace std;int main(){ string s; while(getline(cin,s)) { for(int i=0;s[i]!='\0';i++) s[i]-=7; cout<<s<<endl; } return 0;}
还有一种c语言的做法感觉更好,一个字符一个字符地进行比较。
#include <stdio.h> int main() { char c; while ((c = getchar()) != EOF) if (c != '\n') putchar(c - 7); else printf("\n"); return 0; }
0 0
- UVa458 The Decoder
- The Decoder - UVa458
- UVA458 The Decoder
- UVA458 - The Decoder
- UVa458 - The Decoder-字符串-难度1
- uva458
- The Decoder
- The Decoder
- The Decoder
- Uva 458 - The Decoder
- UVa 458 - The Decoder
- 458 - The Decoder
- JOJ 1240 The Decoder
- 458 - The Decoder
- uva 458 The Decoder
- UVA 458 - The Decoder
- uva-458 - The Decoder
- 458 - The Decoder
- 智睿政府网站管理系统 v9.2.1
- oracle11G 移动数据库
- Linux使用Moduler切换各种MPI环境
- sscanf函数用法详解
- 二分查找总结
- UVA458 - The Decoder
- MySQL的InnoDB引擎强烈建议使用自增主键的原因
- 写网页内容需要注意些什么?
- leetcode 2
- GoogleNet:Going deeper with convolutions
- Caffe与Tensorflow的安装与配置
- 【声明】本人博客已经迁移到博客园,欢迎访问!
- 短信 无联系人头像 控件修改
- 一只小蜜蜂 HDU2044 递推