황찌옹
정리왕옹옹
황찌옹
GitHub Contribution
Loading data ...
  • 분류 전체보기 (158)
    • [ 알고리즘 ] (96)
      • Implementation (24)
      • Brute Force (6)
      • String (4)
      • Greedy (14)
      • DFS, BFS (13)
      • Back Tracking (4)
      • Sort & Binary Search (6)
      • DP (8)
      • Shortest Path (5)
      • Hash (3)
      • Stack, Queue (4)
      • Heap (1)
      • Tree (1)
      • Mathematics (1)
      • Ad-Hoc (1)
      • 기타 (COS Pro, etc) (1)
    • [ 언어 및 문법 ] (23)
      • Python (5)
      • C, C++ (13)
      • SQL (1)
      • 공통 개념(CS) (4)
    • [ Error ] (21)
      • Radiomics Feature Extraction (6)
      • CT Skin Segmentation (12)
      • etc (3)
    • [ Git ] (7)
    • [ 환경 설정 및 기타] (6)
    • [ 공부 ] (2)
      • AI, ML (0)
      • Computer Vision (0)
      • Image Processing (1)
      • QT (0)
      • AWS (1)
      • 의료 (0)
    • [ 포트폴리오 ] (1)
      • 🙋‍♀️자기 소개🙋‍♀️ (1)
      • 프로젝트 (0)
      • 공모전 (0)
      • 자격증 (0)
      • 대내외활동 (0)
      • 논문 (0)
      • 교육 봉사 (0)
    • [ 취준 ] (2)
      • 채용 설명회, 직무 상담 (1)
      • 취준 후기 (1)

블로그 메뉴

  • ❤️깃허브❤️

인기 글

태그

  • QT
  • Cloud
  • SQL
  • 모두의코드
  • 씹어먹는C++
  • keras
  • git
  • tensorflow
  • OpenCV
  • Python
  • config
  • cs
  • pyplot
  • cos pro
  • Visual Studio
  • c++
  • numpy
  • aws
  • configuration
  • Anaconda

최근 댓글

최근 글

전체 방문자
오늘
어제
hELLO · Designed By 정상우.
황찌옹

정리왕옹옹

[ 알고리즘 ]/Brute Force

[백준] 11504. 돌려 돌려 돌림판!

2022. 6. 29. 03:11

 

📌문제

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

 

🎖️난이도

 

✔️풀이

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <math.h>
#include <tuple>
#include <typeinfo>       // operator typeid

using namespace std;

int T, N, M;
int X = 0;
int Y = 0;
int pan[101] = {-1,};
int cnt = 0;
vector<int> cnt_v;

int main() {
    cin >> T;

    for (int n = 0; n < T; n++) {
        cin >> N >> M;

        int tmp;

        for (int i = M; i > 0; i--) {
            cin >> tmp;
            X += tmp * pow(10, i - 1);
        }

        for (int j = M; j > 0; j--) {
            cin >> tmp;
            Y += tmp * pow(10, j - 1);
        }

        for (int k = 0; k < N; k++) {
            scanf("%d", &pan[k]);
        }

        //pow() return : double Çü!!!
        /*
        printf("%d %d %d\n", X, pow(10, 3), M);
        cout << X / pow(10, M-1) << endl;
        cout << int(X / pow(10, M - 1)) << endl;
        cout << typeid(pow(10, M - 1)).name() << typeid(X / pow(10, M - 1)).name() << endl;
        */

        for (int l = 0; l < N; l++) {
            if ((pan[l] < X / int(pow(10, M - 1))) || (pan[l] > Y / int(pow(10, M - 1)))) {
                continue;
            }

            int tmp_num = 0;

            for (int m = 0; m < M; m++) {
                tmp_num += pan[(l + m) % N] * pow(10, M - m - 1); // ´Ù½Ã pan ¸Ç ¾ÕÀ¸·Î
            }
            
            if (tmp_num >= X && tmp_num <= Y) {
                cnt++;
            }
        }

        cnt_v.push_back(cnt);

        X = 0;
        Y = 0;
        cnt = 0;
        pan[101] = { -1, };
    }
    
    for (int idx = 0; idx < T; idx++) {
        cout << cnt_v[idx] << endl;
    }

    
    return 0;
}

'[ 알고리즘 ] > Brute Force' 카테고리의 다른 글

[백준] 1759. 암호 만들기  (0) 2022.07.02
[프로그래머스] 두 개 뽑아서 더하기  (0) 2022.07.02
[프로그래머스] 카펫  (0) 2022.06.29
[프로그래머스] 소수 찾기  (0) 2022.06.29
[프로그래머스] 모의고사  (0) 2022.06.29
    황찌옹
    황찌옹
    다 정리해버리꺼야

    티스토리툴바