結果
| 問題 |
No.565 回転拡大
|
| コンテスト | |
| ユーザー |
conankun
|
| 提出日時 | 2017-10-15 15:53:48 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,768 bytes |
| コンパイル時間 | 455 ms |
| コンパイル使用メモリ | 60,360 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-17 17:46:15 |
| 合計ジャッジ時間 | 1,445 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
void swap(int &a, int &b) {
int t = a;
a = b;
b = t;
}
int main() {
int angle, scale, height, width;
cin >> angle >> scale >> height >> width;
string pattern[10];
for (int i = 0; i < height; i++) {
cin >> pattern[i];
}
//rotating
string rotatedPattern[10];
if (angle == 90 || angle == 270) {
swap(height, width);
}
for (int i = 0; i < height; i++) {
if (angle == 0) {
rotatedPattern[i] = pattern[i];
continue;
}
rotatedPattern[i] = string(width, ' ');
for (int j = 0; j < width; j++) {
if (angle == 90) {
rotatedPattern[i][j] = pattern[width - 1 - j][i];
}
else if (angle == 180) {
rotatedPattern[i][j] = pattern[height - 1 - i][width - 1 - j];
}
else if (angle == 270) {
rotatedPattern[i][j] = pattern[j][height - 1 - i];
}
}
}
//scaling
string scaledPattern[100];
height *= scale;
width *= scale;
for (int i = 0; i < height; i += scale) {
for (int c = 0; c < scale; c++) {
scaledPattern[i + c] = string(width, ' ');
}
for (int j = 0; j < width; j += scale) {
for (int k = 0; k < scale; k++) {
for (int l = 0; l < scale; l++) {
scaledPattern[i + k][j + l] = rotatedPattern[i / scale][j / scale];
}
}
}
}
for (int i = 0; i < height; i++) {
cout << scaledPattern[i] << "\n";
}
int a;
cin >> a;
}
conankun