#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 = ..
#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long ull; typedef pair pii; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; int n, hx, hy; int board[105][105]; int visited[105][105]; struct QData { int x; int y; int p; }; struct QData_comp { bool operator()(const QData &a, const QDa..
#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long ull; typedef pair pii; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; int n, maxPageIDX = -1; int d[502][502]; int main() { cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i > f >> t; d[f][t] = 1; maxPageIDX = max(maxPageIDX, ..
#include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pi_i; struct T{ int x , y , cost; }; int n , m , r , c , s , k; int dx[] = {-2,-2,-1,-1,1,1,2,2}; int dy[] = {-1,1,-2,2,-2,2,-1,1}; const int MAXN_M = 100 , INF = 987654321; int visited[MAXN_M + 5][MAXN_M + 5]; int main(){ cin.tie(0); cout.tie(0); cin >> n >> m >> r >> ..
문제 i가 들어오면 숫자를 받아 stack에 push하고 o가 들어온다면 stack의 가장 위에있는 원소를 출력한뒤 재거 c가 들어온다면 stack의 크기를 출력하는 프로그램을 작성하면 된다. 해결 방법 std::stack을 알면 쉽게 해결 할 수 있다. 정답 코드 #include using namespace std; int main(){ int n; stack st; cin >> n; while(n--){ char x; cin >> x; if(x == 'i'){ int g; cin >> g; st.push(g); } if(x == 'c'){ cout
#include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pi_i; const int modV = 20091024; unsigned long long fast_pow(long long under , long long top){ unsigned long long res = 1; while(top){ if(top & 1)res = (res * under) % modV; under = (under * under) % modV; top >>= 1; } return res % modV; } int main(){ cin.tie(0); cout.t..
#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long ull; typedef pair pii; typedef signed char i8; typedef short i16; typedef int i32; typedef long long i64; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; int n, ans = 0; struct Path { int from; int to; int need; }; vector paths; i..
#include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pii; const int limit_div = 10000; /* Fibo : 1 1 2 3 5 8 13 1 1 & 1 1 > 2 1 1 0 & 1 0 > 1 1 2 1 & 1 1 > 3 2 1 1 & 1 0 > 2 1 3 2 & 1 1 > 5 3 2 1 & 1 0 > 3 2 */ struct twoBtwo{ public: int leftTop; int rightTop; int leftBottom; int rightBottom; public: void limitB(int l) {..