按要求字符串处理

1 #include <iostream>

2 #include <memory.h>
 3 #include <stdlib.h>
 4 #include <string>
 5 using namespace std;
 6 int word[5];
 7 void print()
 8 {
 9         int num=0;
10         for(int i=0;i<5;i++)
11         {
12         //     cout<<word[i];
13                 if(word[i]!=0)
14                 word[i]=(word[i]+1)%2;
15                 num*=2;
16                 num+=word[i];
17         }
18         //cout<<num<<endl;
19         if(num==0)
20                 cout<<" ";
21         else if(num==27)
22                 cout<<"'";
23         else if(num==28)
24                 cout<<",";
25         else if(num==29)
26                 cout<<"-";
27         else if(num==30)
28                 cout<<".";
29         else if(num==31)
30                 cout<<"?";
31         else
32         {
33                 char tem='A';
34                 tem+=(num-1);
35                 cout<<tem;
36         }
37         memset(word,0,sizeof(word));
38 }
39 int main()
40 {
41         string tem;
42         int t=0;
43         while(getline(cin,tem))
44         {
45                 int len=tem.size();
46                 if(tem[0]=='#')
47                         break;
48                 if(tem[0]=='*')
49                 {
50                         if(t!=0)
51                                 print();
52                         memset(word,0,sizeof(word));
53                         t=0;
54                         cout<<endl;
55                 }
56                 int con=0;
57                 for(int i=0;i<len;i++)
58                 {
59                         //cout<<t<<endl;
60                         if(tem[i]!=' ')
61                         {
62                                 if(con==1)
63                                 {
64                                         t++;
65                                         if(t==5)
66                                         {
67                                                 print();
68                                                 t=0;
69                                         }
70                                 }
71                                 con=0;
72                         }
73                         else
74                         {
75                                 con=1;
76                                 word[t]++;      
77                         }
78                 }
79         }
80 }

转载于:https://www.cnblogs.com/congzc/archive/2011/08/16/2329924.html

Sicily/1729. Steganography相关推荐

  1. Hiding Images in Plain Sight: Deep Steganography 于众目睽睽之下隐藏图像:深度隐写术

    Hiding Images in Plain Sight: Deep Steganography 于众目睽睽之下隐藏图像:深度隐写术 1.摘要 隐写术是将秘密信息隐藏在另一条普通信息中的一种实践.通常 ...

  2. python图像隐写技术_图像隐写技术(Image Steganography)

    withopen( "input.jpg", "rb") asf: f_bytes = f.read print( f_bytes[: 2] ) print( ...

  3. BZOJ 3223: Tyvj 1729 文艺平衡树(splay)

    速度居然进前十了...第八... splay, 区间翻转,用一个类似线段树的lazy标记表示是否翻转 ------------------------------------------------- ...

  4. [Tyvj 1729] 文艺平衡树

    题面如下: Tyvj 1729 文艺平衡树 Time Limit: 1 Sec  Memory Limit: 128 MB Description 您需要写一种数据结构(可参考题目标题),来维护一个有 ...

  5. [HZOI 2016][Tyvj 1729]文艺平衡树 这道题我真是哭了,调了一下午,一晚上

    [题目描述] 您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作:翻转一个区间,例如原有序序列是5 4 3 2 1,翻转区间是[2,4]的话,结果是5 2 3 4 1 [ ...

  6. poj 1729 Jack and Jill (搜索,bfs)

    原题网址:http://bailian.openjudge.cn/practice/1729 思路: 方法1: 用点对表示两个人的状态,放在队列中(队列也可以用优先队列),当到达一个点对的路径上的最近 ...

  7. BZOJ 3223: Tyvj 1729 文艺平衡树-Splay树(区间翻转)模板题

    3223: Tyvj 1729 文艺平衡树 Time Limit: 10 Sec  Memory Limit: 128 MB Submit: 6881  Solved: 4213 [Submit][S ...

  8. ZOJ 1729 Hidden Password

    和POJ1509没什么区别,只是输入形式上有些许改变,而且这里要求输出的位置是字符串的 下标,而不用再加1. /*Accepted 1729 C++ 10ms 276kb Yu*/ #include& ...

  9. Sicily 1934 移动小球

    题目地址 http://sicily.3322.org/problem_status.php?pid=1934&p=1 此题参考了秋叶飘零的博客 http://adonis0147.blog. ...

最新文章

  1. 【iOS_Development】文件操作
  2. P、NP、NPC问题最通俗的讲解
  3. R构建分位数回归模型(Quantile Regression)
  4. sql删除重复的数据保留一条_leetcode题库-sql练习精讲系列--九、删除重复
  5. 蓝牙设备探测工具blueranger
  6. AngularJS2.0 quick start——其和typescript结合需要额外依赖
  7. shadows a parameter
  8. VS中PCL库附加依赖项配置
  9. 服务器虚拟化相关问题分析,服务器虚拟化中遇到的存储问题分析
  10. Python正则表达式查找最长数字子串(好未来2017笔试题)
  11. Codeforces Round #296 (Div. 2) C. Glass Carving [ set+multiset ]
  12. JavaScript 中 call()、apply()、bind() 的用法
  13. DevExpress中的自定义报表控件使用
  14. 开源无线管理软件_开源无线电系统向育空地区及其他地区提供紧急警报和音乐
  15. 一二线城市互联网公司汇总,助你拿高薪!
  16. Django Views: Dynamic Content
  17. Generality
  18. 专访:台湾这家设计公司如何hold住甲方爸爸?
  19. LiDAR点云处理软件
  20. Docker学习(一):基础理论基础操作

热门文章

  1. webpack5不要再用url-loader了
  2. php怎么自己写框架,PHP学习笔记,自己动手写个MVC的框架
  3. 计算机专业中职好就业不,内江计算机专业中职好不好
  4. ssm框架逻辑删除mysql_ssm框架小总结——批量删除
  5. oracle 触发器更新视图,关于UPDATE触发器的详细介绍
  6. vim 配置_一步步配置VIM(3)-与latex结合
  7. python.集合转列表_python 列表,元组,字典,集合,字符串相互转换
  8. kafka实现组内广播
  9. 安全随笔1:谨慎一次MD5值的可被穷举性
  10. 【转】vb 关于commondialog的多选