Translate

Views

Saturday, July 27, 2019

Solution Kattis: Skener

https://open.kattis.com/problems/skener
#include<bits/stdc++.h>
#define FOR(i, a, b) for(int i=a; i<=b; i++)
using namespace std;

int n, m, mm, nn;
int ii, jj;
char x;
char a[1001][1001];

int main(){
 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
 cin >> n >> m >> nn >> mm;
 
 FOR(i, 1, n)
 FOR(j, 1, m){
  cin >> x;
  
  ii= i*nn;
  jj= j*mm;
   FOR(k, ii-nn+1, ii)
   FOR(l, jj-mm+1, jj) a[k][l]= x; 
 }
 
 FOR(i, 1, n*nn){
  FOR(j, 1, m*mm) cout<<a[i][j];
  cout<<"\n"; 
 }
 
}
Good luck! If you need help please leave a comment :) 

No comments: