역시 튜토라 쉬웠당
이중 vector 사용과 call reference 방식으로 vector 넘기는 것을 기억해두자!!
#include
#include
#include
using namespace std;
void rect(vector &x_data,vector &y_data);
int main(){
int input;
int i;
int j;
int x;
int y;
vector > x_input;
vector > y_input;
vector x_arr;
vector y_arr;
cin >> input ;
for(i=0;i<input;i++){
for(j=0;j<3;j++){
cin >> x;
cin >> y;
x_arr.push_back(x);
y_arr.push_back(y);
}
x_input.push_back(x_arr);
y_input.push_back(y_arr);
x_arr.clear();
y_arr.clear();
}
for(i=0;i<input;i++){
rect(x_input[i],y_input[i]);
}
}
void rect(vector &x_data,vector &y_data){
int x;
int y;
if(x_data[0] == x_data[1])
x = x_data[2];
else if(x_data[0] == x_data[2])
x = x_data[1];
else
x = x_data[0];
if(y_data[0] == y_data[1])
y = y_data[2];
else if(y_data[0] == y_data[2])
y = y_data[1];
else
y = y_data[0];
cout << x << " " << y << endl;
}
'programming > 알고스팟' 카테고리의 다른 글
알고스팟 - 튜토리얼 HOTSUMMER (0) | 2020.05.15 |
---|---|
알고스팟 - 튜토리얼 mispell (0) | 2020.05.14 |
알고스팟 - 튜토리얼 encrypt (0) | 2020.05.14 |
알고스팟 - 튜토리얼 LECTURE (0) | 2020.05.14 |
알고스팟 - 튜토리얼 ENDIANS (0) | 2020.05.14 |
댓글