MiYu原创, 转帖请注明 : 转载自 ______________白白の屋  

题目地址:

http://acm.hdu.edu.cn/showproblem.php?pid=2526

题目描述:

浪漫手机

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 362    Accepted Submission(s): 150

Problem Description
最近,WisKey迷上了手机铃声,但是他对音律不是很懂,所以他想着能否用计算机来随机生成铃声。当WisKey写好程序后,发现生成出来的根本不是铃声,而是噪声!
之后WisKey查阅了一些乐谱发现,其实很多铃声是以某种规律变化的,这里为了简化这个难题,他以连续3个音符来判断下个音符。
如有模式

在给定第一行乐谱的情况下,按模式将产生如下乐谱图形:

我们用0表示白色格子,用1表示黑色格子。
对于没有连续3个格子的边缘(即没有左边格子或右边格子),我们直接用白色格子代替缺少的那一个格子。
Input
第一行有一个整数T,代表有T组数据。
每组数据有一个整数M,表示要输出M行乐谱。接着有8行模式串,左边是音符模式,右边是下一个音符。最后一行是第一行乐谱。
Output
输出M行,表示M行乐谱。
Sample Input
1 16 111 1 110 1 101 1 100 1 011 1 010 0 001 1 000 0 0000000000000001000000000000000
Sample Output
0000000000000001000000000000000 0000000000000010100000000000000 0000000000000101010000000000000 0000000000001010101000000000000 0000000000010101010100000000000 0000000000101010101010000000000 0000000001010101010101000000000 0000000010101010101010100000000 0000000101010101010101010000000 0000001010101010101010101000000 0000010101010101010101010100000 0000101010101010101010101010000 0001010101010101010101010101000 0010101010101010101010101010100 0101010101010101010101010101010 1010101010101010101010101010101

题目分析 :

纯水 模拟题..........      就是 由 上面 3 个 格子的 颜色 推出下面 中间那块的 颜色.  推出来直接输出就可以了 .

题目开始已经给出了第一行的 颜色 , 下面的可以直接 暴力推出来  用hash很快就能判断.

代码如下 :

/*

Coded By  : MiYu

Link      : http://www.cnblogs.com/MiYu  || http://www.cppblog.com/MiYu

Author By : MiYu

Test      : 1

Program   : 2526

*/

//#pragma warning( disable:4789 )

#include <iostream>

#include <cstdio>

#include <cstring>

using namespace std;

char c[2][50];

int T,t,M;

int main(){

char a[3],b[9];

for(int i=0;i<2;i++) c[i][0]='0';

scanf("%d",&T);

while(T--){

scanf("%d",&M);

for(int i=1;i<=8;i++){

scanf("%s",a);

int num=(a[0]-'0')*4+(a[1]-'0')*2+a[2]-'0';

scanf("%d",&t);

b[num] = '0' + t;

}

scanf("%s",&c[0][1]);

int len=strlen(&c[0][1]);

for(int i=0;i<2;i++) c[i][len+1]='0';

for(int j=0;j<M;j++){

for(int i=0;i<len;i++){

int num=(c[j%2][i]-'0')*4+(c[j%2][i+1]-'0')*2+c[j%2][i+2]-'0';

c[(j+1)%2][i+1]=b[num];

printf("%c",c[j%2][i+1]);

}

printf("\n");

}

}

return 0;

}

转载于:https://www.cnblogs.com/MiYu/archive/2010/09/26/1836117.html

HDOJ 2526 HDU 2526 浪漫手机 ACM 2526 IN HDU相关推荐

  1. HDOJ HDU 1709 The Balance ACM 1709 IN HDU

    //MiYu原创, 转帖请注明 : 转载自 ______________白白の屋 题目地址 :          http://acm.hdu.edu.cn/showproblem.php?pid=1 ...

  2. HDU2526 浪漫手机【模拟】

    浪漫手机 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submissi ...

  3. HDOJ HDU 1849 Rabbit and Grass ACM 1849 IN HDU

    MiYu原创, 转帖请注明 : 转载自 ______________白白の屋 题目地址:          http://acm.hdu.edu.cn/showproblem.php?pid=1849 ...

  4. HDOJ 1157 HDU 1157 Who's in the Middle ACM 1157 IN HDU

    MiYu原创, 转帖请注明 : 转载自 ______________白白の屋   题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=1157 题目描述: ...

  5. HDOJ 1874 HDU 1874 畅通工程续 ACM 1874 IN HDU

    MiYu原创, 转帖请注明 : 转载自 ______________白白の屋 题目地址:          http://acm.hdu.edu.cn/showproblem.php?pid=1874 ...

  6. HDOJ HDU 2080 夹角有多大II ACM 2080 IN HDU

    MiYu原创, 转帖请注明 : 转载自 ______________白白の屋 题目地址:          http://acm.hdu.edu.cn/showproblem.php?pid=2080 ...

  7. HDOJ 1213 HDU 1213 How Many Tables ACM 1213 IN HDU

    MiYu原创, 转帖请注明 : 转载自 ______________白白の屋 题目地址:          http://acm.hdu.edu.cn/showproblem.php?pid=1213 ...

  8. HDOJ 1016 HDU 1016 Prime Ring Problem ACM 1016 IN HDU

    题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=1016 题目描述: Prime Ring Problem Time Limit: 4000/2000 ...

  9. HDOJ 1253 HDU 1253 胜利大逃亡 ACM 1253 IN HDU

    MiYu原创, 转帖请注明 : 转载自 ______________白白の屋   题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=1253 题目描述: ...

最新文章

  1. RN Exception: Before building your project, you need to accept the license agreements and comp le...
  2. 提高工作效率-shell操作快捷键
  3. 测试教程网.unittest教程.7. 各种断言方法
  4. reactjs redux入门完整版示例:store reducer getState dispatch subscribe action
  5. Linux netstat -tunlp查看端口占用情况
  6. 鸿蒙so系统,鸿蒙手机版JNI实战(JNI开发、SO库生成、SO库使用)
  7. 计算机三级网络技术题库第15套,第15套 上机操作题
  8. vscode python第三方库检测_VSCode中使用Pylint检查python代码
  9. 戴姆勒:停止内燃机研发 马斯克:欢迎进群!
  10. 如何在Windows Server 2016上配置iSCSI启动器
  11. 使用Ant编译Hadoop eclipse插件
  12. java json serialize_java-是否可以简化@JsonSerialize注释?
  13. h5网页小游戏php源码,H5 组词小游戏源代码
  14. Mac:彻底卸载MySQL
  15. 为你的Android应用构建窗口小部件(App Widget)
  16. reset()方法 submit()方法
  17. Skype不能打开解决记录(win7)
  18. 京东商城(mysql+python)
  19. (待优化)python入门
  20. [枚举] COGS 1580 [WC2005]友好的生物

热门文章

  1. 第0周作业2:博客阅读和思考
  2. Android Studio Gradle构建脚本
  3. XMPP之openfire无法启动
  4. hexo 环境变量_小白使用 Github + Hexo 从 0 搭建一个博客
  5. js 解除网页右键菜单被禁用
  6. Didn't find class cn.jpush.android.service.DownloadProvider on path:
  7. android 日期选择器
  8. Spring Cloud 采用Consul做配置中心
  9. hive sqoop导出 postgresql精度丢失_Mysql 与 hadoop 数据同步(迁移),你需要知道 Sqoop...
  10. 30 | 图的表示:如何存储微博、微信等社交网络中的好友关系?