#include int main(){ std::cout
#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pii; template struct MIN_HEAP { vector heap; MIN_HEAP(){ heap.push_back(-1); } void add(T x) { heap.push_back(x); int c = heap.size() - 1; while(c > 1 && heap[c / 2] > heap[c]) { swap(heap[c / 2] , heap[c]); c /= 2; } } bool empty() { return heap.size(..
#include using namespace std; typedef long long ll; typedef pair pii; /** 2679원이 있음 13원을 만들어야됨 (가장 동전을 많이 사용해서 (많이 쓰는 코드는 WA 인디)) (근디 지금은 가장 적게 사용하는건디... (이 코드 자체는 맞는뎅) -> 응용 해야됨) 13은 항상 만들수 있다. 2666또한 항상 만들수 있다? **/ int main(){ int w , ansCnt = 0 , money = 0; int cnt[10]; int price[10] = {500,100,50,10,5,1}; int used[10]; cin >> w >> cnt[0] >> cnt[1] >> cnt[2] >> cnt[3] >> cnt[4] >> cnt[5]; for..
#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pii; int dx[] = {0 , 0 , 1 , -1}; int dy[] = {1 , -1 , 0 , 0}; /* 원래 N(1 ~ 15)가 베타에서 N(115) 문제 조건 1 20) return; cout
#include using namespace std; typedef long long ll; typedef pair pii; int n , m; vector nums; void roll(int step , int added){ if(step >= n){ if(added == m){ for(auto i :nums){ cout > m; roll(0 , 0); }
#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pii; typedef vector vi; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; int other(int a, int b) { if (a > b) swap(a, b); if (a == 1 && b == 2) return 3; if (a == 1 && b == 3) return 2; if (a == 2 && b == 3) return 1; return -1; } void hanoi(int ste..
#include using namespace std; typedef long long ll; typedef pair pii; int n; ll cow[80005]; ll ans; stack st; int main(){ cin.tie(0); cout.tie(0); cin >> n; for(int i = 0;i > cow[i]; while(!st.empty() && st.top()
#include #include #include #include #include #include #include #include #include #include /** 3 1 10000000 10000000 10000000 */ using namespace std; typedef long long ll; typedef pair pii; const int ml = 505; ll works[ml]; ll maxW = 0; int m , k; bool solve_(ll ma_) { if(ma_ ma_) { sum = (ll)works[i]; c..
#include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pi_i; bool board[105][105]; int getSi(int y , int x , int ye , int xe){ int size = 0; for(int i = y;i n; for(int i = 0;i > x >> y; for(int j = 0;j < 10;j++){ for(int k = 0;k < 10;k++){ board[y + j][x + k] = 1; } } } int maxSum = 0; for(int i = ..