当前位置:网站首页>PAT B1066
PAT B1066
2022-06-25 19:56:00 【Madness makes freedom】
1066 Image filtering (15 branch )
Image filtering is to dye the unimportant pixels in the image into the background color , Make important parts stand out . Now give a black-and-white image , You are required to replace all pixel colors with a specified color when the gray value is within a specified range .
Input format :
Input gives the resolution of an image on the first line , That is, two positive integers M and N(0<M,N≤500), The other is the end point of the gray value interval to be filtered A and B(0≤A<B≤255)、 And the specified replacement gray value . And then M That's ok , Each line gives N The gray value of a pixel , Separated by spaces . All gray values are in [0, 255] Within the interval .
Output format :
Output the filtered image as required . The output M That's ok , Each row N Pixel gray value , Percentage of each gray value 3 position ( For example, black should be displayed as 000
), Separated by a space . There must be no extra space at the beginning and end of the line .
sample input :
3 5 100 150 0
3 189 254 101 119
150 233 151 99 100
88 123 149 0 255
sample output :
003 189 254 000 000
000 233 151 099 000
088 000 000 000 255
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int m,n,a,b,ch;
cin >> m >> n >> a >> b >> ch;
int x;
while(m--)
{
for(int i=0;i<n;i++)
{
scanf("%d",&x);
if(x>=a&&x<=b)
printf("%03d",ch);
else
printf("%03d",x);
if(i<n-1)
printf(" ");
else
printf("\n");
}
}
return 0;
}
边栏推荐
- Vulnhub range - the planes:venus
- JS advanced
- Tcp/ip test questions (III)
- Redis cache preheating & avalanche & breakdown & penetration
- Arduino read temperature
- Embark on a new journey and reach the world with wisdom
- From now on, I will blog my code
- Number of wechat applet custom input boxes
- Wechat applet swiper simple local picture display appears large blank
- 在打新債開戶證券安全嗎?低傭金靠譜嗎
猜你喜欢
Vulnhub range - the planes:venus
Huawei released two promotion plans to promote AI talent development and scientific research innovation
What should I pay attention to in GoogleSEO content station optimization?
PAT B1076
SEO outsourcing reliable company, enterprise SEO outsourcing company which reliable?
Applet wx Request encapsulation
Vulnhub range the planes: mercury
The native JS mobile phone sends SMS cases. After clicking the button, the mobile phone number verification code is sent. The button needs to be disabled and re enabled after 60 seconds
Vulnhub range - darkhole 1
Ali visual AI training camp -day05- creativity day - your image recognition project
随机推荐
Paddleocr learning (II) paddleocr detection model training
Profile path and name
Vulnhub range - darkhole 1
System optimization method
Jsonp processing non homologous
Life cycle function of composite API
New features of php7
打新债证券开户安全吗
Network security detection and prevention test questions (II)
VMware failed to prompt to lock this profile exclusively
Network security detection and prevention test questions (V)
Network security detection and prevention test questions (I)
Redis cache preheating & avalanche & breakdown & penetration
Hdoj topic 2005 day
在打新債開戶證券安全嗎?低傭金靠譜嗎
一、HikariCP获取连接流程源码分析一
Solve the problem that sublime Text3 package control cannot install plug-ins
Wechat applet cloud function does not have dependency option installed
PHP little knowledge record
Vulnhub range - the planes:venus