-
Notifications
You must be signed in to change notification settings - Fork 1
/
Redimensionare imagine.cpp
60 lines (51 loc) · 1.33 KB
/
Redimensionare imagine.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int i,j,m,s,a;
cin>>m>>s;
struct Triplet{
int r;
int g;
int b;
} c[100][100];
struct Triplet max;
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
{
cin>>c[i][j].r>>c[i][j].g>>c[i][j].b;
}
}
int xM,yM,ii,jj;
xM = 0; yM = 0;
for(i=0;i<m;i+=s)
{
for(j=0;j<m;j+=s)
{
max.r=-9999; max.g=-9999; max.b=-9999;
for(int x = 0;x<s;x++)
{
for(int y = 0; y<s; y++)
{
ii = i+x;
jj = j+y;
if(c[ii][jj].r>max.r)
{
max.r=c[ii][jj].r;
}
if(c[ii][jj].g>max.g)
{
max.g=c[ii][jj].g;
}
if(c[ii][jj].b>max.b)
{
max.b=c[ii][jj].b;
}
}
}
cout<<max.r<<" "<<max.g<<" "<<max.b<<endl;
}
}
}