#include #include using namespace std; struct cord { int x; int y; }; bool map[102][102]; int visited[102][102]; void input_map(int N, int M) { char c; for (int i = 1; i c; if (c == '1') map[i][j] = 1; else map[i][j] = 0; } } int solv_maze(int n, int m, cord s) { //int cnt = 0; queue q; q.push(s); cord next; cord now = q.front(); visited[now.y][now.x] = 1; while (!q.empty()) { now = q.front(); q..
#include using namespace std; int main(){ int goal; cin >> goal; int t_length=64; int sht=64; int cnt=1; while(t_length>goal) { sht/=2; cnt++; if(t_length-sht>=goal) {t_length-=sht;cnt--;} } cout while(t_length>goal)가지고 있는 막대 중 길이가 가장 짧은 것을 절반으로 자른다. ->sht/=2; 개수는 1개가 2개가 되니 cnt++;만약, 위에서 자른 막대의 절반 중 하나를 버리고 남아있는 막대의 길이의 합이 X보다 크거나 같다면 ->if(t_length-sht>=goal) , 위에서 자른 막대의 절반 중 하나를 버린다. -> t_len..
#include using namespace std;int max(int a, int b){return a > b ? a : b;}int max(int a, int b, int c){return max(a, b) > c ? max(a, b) : c;}int min(int a, int b){return a > N;int max_arr[2][3] = { 0 };int min_arr[2][3] = { 0 };int input[3] = { 0 }; for (int i = 1; i > input[0] >> input[1] >> in..