結果

問題 No.565 回転拡大
ユーザー y_mazuny_mazun
提出日時 2017-09-08 22:53:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,044 bytes
コンパイル時間 595 ms
コンパイル使用メモリ 47,084 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 21:26:54
合計ジャッジ時間 1,455 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,248 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:24:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |     scanf("%s", buff);
      |     ~~~~~^~~~~~~~~~~~
main.cpp: In function ‘int getInt()’:
main.cpp:5:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 | inline int getInt(){ int s; scanf("%d", &s); return s; }
      |                             ~~~~~^~~~~~~~~~

ソースコード

diff #

#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <queue>
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>

using namespace std;

int main(){
  const int r = getInt() / 90;
  const int k = getInt();
  const int h = getInt();
  const int w = getInt();
  const int n = max(h, w);
  vector<vector<char> > g(n, vector<char>(n, ' '));
  const int ww = r % 2 == 0 ? w : h;
  const int hh = r % 2 == 0 ? h : w;


  REP(i,h){
    char buff[256];
    scanf("%s", buff);
    REP(j,w) g[i][j] = buff[j];
  }

  REP(_,r){
    vector<vector<char> > next(n, vector<char>(n));
    REP(i,n) REP(j,n){
      next[j][n - 1 - i] = g[i][j];
    }
    g.swap(next);
    // REP(i,n) { REP(j,n) { printf("%c", g[i][j]); } puts(""); };
    // puts("---");
  }

  int oX = n;
  int oY = n;

  REP(i,n) REP(j,n) if(g[i][j] != ' ') {
    oX = min(oX, j);
    oY = min(oY, i);
  }

  // printf("%d %d\n", oX, oY);
  REP(i,hh) REP(_, k) { REP(j,ww) REP(_, k) { printf("%c", g[oY + i][oX + j]); } puts(""); };

  return 0;
}
0