結果

問題 No.565 回転拡大
ユーザー FF256grhy
提出日時 2017-10-06 05:04:54
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,488 bytes
コンパイル時間 12,068 ms
コンパイル使用メモリ 401,904 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-17 00:08:31
合計ジャッジ時間 13,424 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(dead_code, unused_macros)]
macro_rules! ID { ($a: expr, $b: expr) => ($a as usize .. $b as usize) }
macro_rules! II { ($a: expr, $b: expr) => ($a as usize .. ($b + 1) as usize) }
macro_rules! PR { ($($a: expr),*) => (print!  ($($a),*)) }
macro_rules! PL { ($($a: expr),*) => (println!($($a),*)) }
fn swap<T: Copy>(x: &mut T, y: &mut T) { let t = *x; *x = *y; *y = t; }
macro_rules! SWAP { ($a: expr, $b: expr) => (swap(&mut $a, &mut $b);) }

// ---- ----

fn main() {
	let mut rd = Read::new();
	let r = rd.int();
	let k = rd.int() as usize;
	let mut h = rd.int() as usize;
	let mut w = rd.int() as usize;
	let mut c = vec![vec![0__u8; 10]; 10];
	for i in ID!(0, h) { c[i] = rd.str().into_bytes(); }
	
	
	for _ in 0..(r / 90) {
		let mut d = vec![vec![0; 10]; 10];
		for i in ID!(0, h) {
		for j in ID!(0, w) {
			d[j][h - 1 - i] = c[i][j];
		}
		}
		SWAP!(h, w);
		c = d;
	}
	
	for i in ID!(0, h * k) {
	for j in ID!(0, w * k) {
		PR!("{}", c[i / k][j / k] as char);
	} PL!();
	}
}

// ---- ----

struct Read {
	b: String,
	v: std::collections::VecDeque<String>,
}

impl Read {
	fn new() -> Self {
		Read { b: String::new(), v: std::collections::VecDeque::new() }
	}
	
	fn str(&mut self) -> String {
		if self.v.len() == 0 {
			self.b = String::new();
			std::io::stdin().read_line(&mut self.b).unwrap();
			self.v = self.b.trim().split(' ').map(|x| x.to_string()).collect();
		}
		self.v.pop_front().unwrap()
	}
	
	fn int(&mut self) -> i64 {
		self.str().parse().unwrap()
	}
}
0