前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >专栏 >1066 图像过滤 (15 分)

1066 图像过滤 (15 分)

作者头像
可爱见见
发布于 2019-10-30 03:27:10
发布于 2019-10-30 03:27:10
30000
代码可运行
举报
文章被收录于专栏:卡尼慕卡尼慕
运行总次数:0
代码可运行

【我的代码】

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
#include<iostream>
using namespace std;
int main(){
    int N, M, A, B, zhiding;
    scanf("%d %d %d %d %d", &N, &M, &A, &B, &zhiding);
    int a[N][M];
    int tmp;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            scanf("%d", &tmp);
            if(tmp >= A && tmp <= B)
                tmp = zhiding;
            a[i][j] = tmp; 
        }
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            printf("%03d", a[i][j]);
            if(j != M-1)   printf(" ");
        }
        if(i != N) printf("\n");
    }
    return 0;
} 

【思路】

这题的考点应该是二维数组的使用吧,实际上两个嵌套循环就可以解决了,注意输出的时候,如果为0,输出应该是000,这在类似的题目中算是一个测试点

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2019-10-27,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 卡尼慕 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
1066 图像过滤 (15 分)
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
韩旭051
2019/11/08
3220
2018 团队设计天梯赛题解---华山论剑组
2018 年度的团队设计天梯赛前几天结束了。但是成绩真的是惨不忍睹。。。毕竟是团队的比赛,如果团队平均水平不高的话,单凭一个人,分再高也很难拉起来(当然,一个人能单挑一个队的大神除外)。
指点
2019/01/18
2.7K0
PAT(乙级)1066.图像过滤(15)
图像过滤是把图像中不重要的像素都染成背景色,使得重要部分被凸显出来。现给定一幅黑白图像,要求你将灰度值位于某指定区间内的所有像素颜色都用一种指定的颜色替换。
lexingsen
2022/02/25
1990
PTA 1066 图像过滤 (15 分)
图像过滤是把图像中不重要的像素都染成背景色,使得重要部分被凸显出来。现给定一幅黑白图像,要求你将灰度值位于某指定区间内的所有像素颜色都用一种指定的颜色替换。
freesan44
2021/08/21
3760
2017.7.21夏令营清北学堂解题报告
预计分数: 60+30+0=90=划水 实际分数: 90+30+20=140=rank5=雷蛇鼠标 一句话总结:今天该买彩票! T1: 题目描述 从前有一个?行?列的网格。 现在有?种颜色,第?种
attack
2018/04/12
7630
1072 开学寄语 (20 分)
【我的代码】 //1072 开学寄语 (20 分) #include <iostream> #include <map> #include <vector> using namespace std; int main(){ int N, M; cin>>N>>M;//学生人数和物品种类数 map<int, int> m; int count = 0; int thing[M]; int tmp; for(int i = 0; i < M; i++){
可爱见见
2019/10/30
4050
1072 开学寄语 (20 分)
1075 链表元素分类 (25 分)
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
韩旭051
2019/11/08
5620
L3-004. 肿瘤诊断
在诊断肿瘤疾病时,计算肿瘤体积是很重要的一环。给定病灶扫描切片中标注出的疑似肿瘤区域,请你计算肿瘤的体积。
指点
2019/01/18
5170
yodgor mirzajonov_jacqueline novogratz
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
全栈程序员站长
2022/11/10
2820
PAT 1029 Median (25分) 有序数组合并
Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 12, and the median of S2 = { 9, 10, 15, 16, 17 } is 15. The median of two sequences is defined to be the median of the nondecreasing sequence which contains all the elements of both sequences. For example, the median of S1 and S2 is 13.
vivi
2020/07/14
2740
【kAriOJ】离散数学 构造群码 极大似然法解码
第二行输入m × (n - m) 个0或1,也就是矩阵H的上半部分,下半部分单位矩阵自行生成;
饶文津
2020/06/02
5480
数据结构期末52道OnlineJudge机试题目考核-大二上
<!--more--> <center> <a href="https://s2.ax1x.com/2019/12/28/lmEb9K.png" class="highslide" onclick="return hs.expand(this,{slideshowGroup:'images'})"><img src="https://s2.ax1x.com/2019/12/28/lmEb9K.png" alt="lmEb9K.png" border="0" /></a></center> **所有题目全部在杭电OJ完成:**[http://acm.hdu.edu.cn/](http://acm.hdu.edu.cn/) ```c //1000 A + B Problem #include<iostream> using namespace std; int main(){ int a,b,sum; while(cin>>a>>b){ sum = 0; sum = a + b; cout<<sum<<endl; } } ``` ```c //1005 Number Sequence #include <iostream> int A,B; int f(int n){ if( n == 1 || n == 2){ return 1; } return (A*f(n-1)+B*f(n-2))%7; } int main(){ int n; while(scanf("%d%d%d",&A,&B,&n)!=EOF,A||B||n){ int a = f(n%49); printf("%d\n",a); } } ``` ```c //1008 Elevator #include<iostream> using namespace std; int main(){ int n,a[100],i,sum; while(cin>>n&&n!=0){ sum = 0; for(i=0;i<n;i++){ cin>>a[i]; } if(n==1){ sum = a[0]*6+5; } else{ sum = n*5+a[0]*6; for(i=0;i<n-1;i++){ if(a[i+1]>a[i]){ sum += (a[i+1]-a[i])*6; } else{ sum += (a[i]-a[i+1])*4; } } } cout<<sum<<endl; } } ``` ```c //1012 u Calculate e #include<stdio.h> int main() { double e; int i, tmp; e = 1; tmp = 1; printf("n e\n"); printf("- -----------\n"); printf("0 1\n"); for(i = 1; i < 10; i++) { tmp *= i; e += 1.0/tmp; if(i>=3) printf("%d %.9lf\n", i, e); else if(2 == i) printf("%d %.1lf\n", i, e); else printf("%d %.0lf\n",i, e); } } ``` ```c //1032 The 3n + 1 problem #include <iostream> using namespace std; int main() { int a,b,t,i,max; while(cin >> a >> b) { cout << a << " " << b << " "; if(a>b)//大小不确定 { t = a; a = b; b = t; } max = 0;
王荣胜
2020/03/12
6880
C++上机考试试题解析
C++上机考试试题解析 0x1 求日期是该年的第几天 输入日期(年、月、日),输出它是该年的第几天。 Input year, month, day:1981 3 1 判断闰年方法:a%4==0&&a%100!=0||a%400==0 #include<iostream> using namespace std; int main() { cout<<"Input year, month, day:"; int a,b,c,temp=0; int days,i; cin>>a
慕白
2018/07/06
6.1K0
1081 检查密码 (15 分)
本题要求你帮助某网站的用户注册模块写一个密码合法性检查的小功能。该网站要求用户设置的密码必须由不少于6个字符组成,并且只能有英文字母、数字和小数点 .,还必须既有字母也有数字。
可爱见见
2019/11/11
1.3K0
【未完成】1035 插入与归并 (25 分)
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
韩旭051
2019/11/08
5030
【题解】排列计数
可发现该问题是错排的一个变形。题目要求的是有"m 个位置 i,使得 ai=ia_i = iai​=i。"。相当于从n个数中,挑m个位置不变动,剩下的进行错排。
fishhh
2022/08/31
2110
【题解】排列计数
L3-003. 社交集群
在社交网络平台注册时,用户通常会输入自己的兴趣爱好,以便找到和自己兴趣相投的朋友。有部分兴趣相同的人们就形成了“社交集群”。现请你编写程序,找出所有的集群。
指点
2019/01/18
6890
PAT(甲级)1121.Damn Single(25)
“Damn Single (单身狗)” is the Chinese nickname for someone who is being single. You are supposed to find those who are alone in a big party, so they can be taken care of. 输入格式: Each input file contains one test case. For each case, the first line gives a positive integer N (≤ 50,000), the total number of couples. Then N lines of the couples follow, each gives a couple of ID’s which are 5-digit numbers (i.e. from 00000 to 99999). After the list of couples, there is a positive integer M (≤ 10,000) followed by M ID’s of the party guests. The numbers are separated by spaces. It is guaranteed that nobody is having bigamous marriage (重婚) or dangling with more than one companion.
lexingsen
2022/02/25
2460
pat 520钻石争霸赛
快速读题从样例读取大概意思,从1-n个数中,除去有d的忌讳数字。第一感觉遍历,直接遍历从1-n,对每一个数字进行判断,获取每个数字的个位数,十位数…可以使用%10。但这里我直接存储为string类型,is_right()函数判断是否是忌讳数字d,主函数一层for循环。时间复杂度不太好计算,往后数越大,判断循环的也越大。但是基本还是o(n)
废江_小江
2022/09/05
3930
pat 520钻石争霸赛
2017广东工业大学程序设计竞赛初赛 题解&源码(A,水 B,数学 C,二分 D,枚举 E,dp F,思维题 G,字符串处理 H,枚举)
Problem A: An easy problem Description     Peter Manson owned a small house in an obscure street. It was a weather-beaten tenement of wood, containing some six or eight rooms, all of which, with one exception, were given over to dirt, cobwebs, gloom, and d
Angel_Kitty
2018/04/08
9790
相关推荐
1066 图像过滤 (15 分)
更多 >
领券
社区富文本编辑器全新改版!诚邀体验~
全新交互,全新视觉,新增快捷键、悬浮工具栏、高亮块等功能并同时优化现有功能,全面提升创作效率和体验
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文