Problem
Problem URL : 크로스워드 만들기
[1] Answer Code (18. 04. 15)
#include<iostream>
using namespace std;
string a,b;
pair<int,int> find(int a_size, int b_size){
for(int i=0; i<a_size; i++){
for(int j=0; j<b_size; j++){
if(a[i] == b[j]){
return make_pair(i, j);
}
}
}
return make_pair(-1, -1);
}
int main(){
cin >> a >> b;
int a_size = (int) a.size();
int b_size = (int) b.size();
pair<int,int> p = find(a_size,b_size);
for(int i=0; i<b_size; i++){
for(int j=0; j<a_size; j++){
if ( j == p.first )
printf("%c",b[i]);
else if ( i == p.second )
printf("%c",a[j]);
else
printf(".");
}
printf("\n");
}
return 0;
}
Code Review
[1] Answer Code (18. 04. 15)
-
Contest > Croatian Open Competition in Informatics > COCI 2011/2012 > Contest #5 1번
-
평범했다.