백준 알고리즘 23808번 : 골뱅이 찍기 - ㅂ

Zoo Da·2021년 12월 18일
0

백준 알고리즘

목록 보기
299/337
post-thumbnail

링크

https://www.acmicpc.net/problem/23808

sol1) 구현

#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define int int64_t
using namespace std;

int32_t main(){
  fastio;
  int n; cin >> n;
  const int sz = 5*n;
  for(int i = 1; i <= sz; i++){
    for(int j = 1 ; j <= sz; j++){
      if(i >= sz - n + 1  || (sz - 3*n + 1 <= i && i <= sz - 2*n) || j >= sz - n + 1 || j <= n) cout << "@";
      else cout << " ";
    }
    cout << "\n";
  }
}

규칙성을 이용해서 ㅂ모양으로 만들어 주면 됩니다

profile
메모장 겸 블로그

0개의 댓글