Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int r, s, x, y, i, j, raspon;
- scanf("%d %d", &r, &s);
- char a[r][s];
- char a_out1[r][2 * s];
- char a_out2[r][2 * s];
- for ( i = 0; i < r; i++ ){
- for ( j = 0; j < s; j++ ){
- scanf(" %c", &a[i][j]);
- }
- }
- scanf("%d %d", &x, &y);
- // prva polovica
- for ( i = 0; i < r; i++ ){
- for ( j = 0; j < s; j++ ){
- a_out1[i][j] = a[i][j];
- a_out1[i][2 * s - j - 1] = a[i][j];
- }
- }
- raspon = r - 1;
- for ( i = raspon; i >= 0; i-- ){
- for ( j = 0; j < 2 * s; j++ ){
- a_out2[raspon - i][j] = a_out1[i][j];
- }
- }
- //promjena znaka
- if ( x <= r){
- if ( a_out1[x - 1][y - 1] == '.' ){
- a_out1[x - 1][y - 1] = '#';
- }
- else{
- a_out1[x - 1][y - 1] = '.';
- }
- }
- else{
- if ( a_out1[x - r - 1][y - 1] == '.' ){
- a_out1[x - r - 1][y - 1] = '#';
- }
- else{
- a_out1[x - r - 1][y - 1] = '.';
- }
- }
- //ispis
- for ( i = 0; i < r; i++ ){
- for ( j = 0; j < 2 * s; j++ ){
- printf("%c", a_out1[i][j]);
- }
- puts("");
- }
- for ( i = 0; i < r; i++ ){
- for ( j = 0; j < 2 * s; j++ ){
- printf("%c", a_out2[i][j]);
- }
- puts("");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement