USACO Bronze 2016 December - The Cow-Signal
Authors: Benjamin Qi, Jesse Choe, Jeffery Meng
Video Solution
By Jeffrey Meng
Video Solution Code
Implementation
Time Complexity:
C++
#include <bits/stdc++.h>using namespace std;void setIO(string name = "") {ios_base::sync_with_stdio(0);cin.tie(0);if (name.size()) {freopen((name + ".in").c_str(), "r", stdin);freopen((name + ".out").c_str(), "w", stdout);}
Java
import java.io.*;import java.util.*;public class CowSignal {public static void main(String[] args) throws IOException {BufferedReader read = new BufferedReader(new FileReader("cowsignal.in"));StringTokenizer initial = new StringTokenizer(read.readLine());int height = Integer.parseInt(initial.nextToken());int width = Integer.parseInt(initial.nextToken());
Python
with open("cowsignal.in") as read:height, width, scale = map(int, read.readline().split())signal = [read.readline() for _ in range(height)]with open("cowsignal.out", "w") as written:for i in range(scale * height):for j in range(scale * width):print(signal[i // scale][j // scale], end="", file=written)print(file=written)
Join the USACO Forum!
Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!