kuangbin专题一 简单搜索
弱菜做了好久23333333........
传送门: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=105278#overview
A 只能摆k个棋子,只能摆在#
- #include <cstring>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- const int max_n = ;
- char maze[max_n][max_n];
- bool vis[max_n];
- int n, m, ans, cnt;
- void init(){
- memset(maze, , sizeof(maze));
- ans = cnt = ;
- }
- void dfs(int k){
- if(cnt == m){ ++ans; return ; }
- if(k > n) return ;
- for(int i = ; i < n; ++i){
- if(maze[i][k] == '#' && !vis[i]){
- vis[i] = ; ++cnt;
- dfs(k+);
- vis[i] = ; --cnt;
- }
- }
- dfs(k+);
- }
- int main(){
- ios::sync_with_stdio(false);
- while(cin >> n >> m){
- if(n == m && n == -) break;
- init();
- for(int i = ; i < n; ++i){
- cin.get();
- for(int j = ; j < n; ++j) cin >> maze[i][j];
- }
- dfs();
- cout << ans << endl;
- }
- return ;
- }
B 三维BFS
- #include <cstdio>
- #include <queue>
- #include <cstring>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- const int max_n = ;
- const int cx[] = {, , , -, , };
- const int cy[] = {, , -, , , };
- const int cz[] = {, , , , , -};
- int maze[max_n][max_n][max_n];
- bool vis[max_n][max_n][max_n];
- struct point{
- int x, y, z, step;
- };
- int L, R, C;
- int ex, ey, ez;
- int main(){
- ios::sync_with_stdio(false);
- while(cin >> L >> R >> C){
- if(L == && R == && C == ) break;
- queue<point> q;
- memset(vis, , sizeof(vis));
- memset(maze, , sizeof(maze));
- for(int k = ; k < L; ++k){
- for(int i = ; i < R; ++i){
- cin.get();
- for(int j = ; j < C; ++j){
- char ch = cin.get();
- if(ch == 'S'){
- maze[k][i][j] = ;
- point p = {k, i, j, };
- q.push(p);
- }
- else if(ch == '.') maze[k][i][j] = ;
- else if(ch == 'E'){
- maze[k][i][j] = ;
- ex = k; ey = i; ez = j;
- }
- }
- }
- cin.get();
- }
- int x, y, z, step;
- while(!q.empty()){
- point p = q.front();
- q.pop();
- x = p.x, y = p.y, z = p.z, step = p.step;
- if(x == ex && y == ey && z == ez) break;
- for(int i = ; i < ; ++i){
- int nx = x + cx[i], ny = y + cy[i], nz = z + cz[i];
- if(nx<||L<nx||ny<||R<ny||nz<||C<nz) continue;
- if(maze[nx][ny][nz]){
- maze[nx][ny][nz] = ;
- point tp = {nx, ny, nz, step + };
- q.push(tp);
- }
- }
- }
- if(x == ex && y == ey && z == ez) printf("Escaped in %d minute(s).\n", step);
- else printf("Trapped!\n");
- }
- return ;
- }
C 搜......
- #include <cstdio>
- #include <queue>
- #include <cstring>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- struct point{
- int x, step;
- };
- int S, E;
- int vis[];
- int main(){
- ios::sync_with_stdio(false);
- while(cin >> S >> E){
- memset(vis, , sizeof(vis));
- vis[S] = ;
- queue<point> q;
- q.push(point{S, });
- int x, step;
- while(!q.empty()){
- point p = q.front();
- x = p.x; step = p.step;
- q.pop();
- if(x == E) break;
- for(int i = ; i < ; ++i){
- int nx;
- if(i == ) nx = x + ;
- else if(i == ) nx = x - ;
- else nx = x << ;
- if( <= nx && nx <= && !vis[nx]){ q.push(point{nx, step+}); vis[nx] = ; }
- }
- }
- cout << step << endl;
- }
- return ;
- }
D 卡了好久看了题解 第一行确定下来后其他行的也都确定下来了(说的好有道理),所以枚举第一行状态,确定下其他行,看最后一行是否都是0
然后在这道题发现了之前二进制枚举的一个错误....... 正确姿势:(i>>j) & 1(吧?)
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- const int MAXN = ;
- const int INF = 0x3f3f3f3f;
- const int cx[] = {, , -, };
- const int cy[] = {, -, , };
- int n, m;
- int ans[MAXN][MAXN];
- int flip[MAXN][MAXN];
- int origin[MAXN][MAXN];
- int check(int x, int y){
- int cnt = origin[x][y];
- for(int i = ; i < ; ++i){
- int nx = x + cx[i], ny = y + cy[i];
- if(nx >= && nx < n && ny >= && ny < m)
- cnt += flip[nx][ny];
- }
- return cnt & ;
- }
- int duang(){
- for(int i = ; i < n; ++i)
- for(int j = ; j < m; ++j)
- if(check(i-, j)) flip[i][j] = ;
- for(int j = ; j < m; ++j)
- if(check(n-, j)) return ;
- int cnt = ;
- for(int i = ; i < n; ++i)
- for(int j = ; j < m; ++j)
- cnt += flip[i][j];
- return cnt;
- }
- int main(){
- while(cin >> n >> m){
- memset(origin, , sizeof(origin));
- for(int i = ; i < n; ++i)
- for(int j = ; j < m; ++j)
- cin >> origin[i][j];
- int tans = INF;
- for(int i = ; i < (<<m); ++i){
- memset(flip, , sizeof(flip));
- for(int j = ; j < m; ++j)
- flip[][j] = (i>>j) & ;
- int cnt = duang();
- if(cnt < tans && cnt != ){
- tans = cnt;
- memcpy(ans, flip, sizeof(flip));
- }
- }
- if(tans == INF) cout << "IMPOSSIBLE" << endl;
- else{
- for(int i = ; i < n; ++i)
- for(int j = ; j < m; ++j)
- cout << ans[i][j] << " \n"[j==m-];
- }
- }
- return ;
- }
E 听说答案都在long long范围内hhhh.......
- #include <queue>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- typedef long long ll;
- int main(){
- ios::sync_with_stdio(false);
- int n;
- while(cin >> n){
- if(n == ) break;
- queue<ll> q;
- q.push(1LL);
- while(!q.empty()){
- ll k = q.front();
- q.pop();
- if(k % n == ){
- cout << k << endl;
- break;
- }
- q.push(k*);
- q.push(k*+);
- }
- }
- return ;
- }
F GOJ有这道题........
- #include <map>
- #include <set>
- #include <queue>
- #include <deque>
- #include <cmath>
- #include <string>
- #include <vector>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <utility>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int m, n;
- bool isPrime[];
- int vis[];
- void preprocess(){
- memset(isPrime, true, sizeof(isPrime));
- isPrime[] = isPrime[] = false;
- for(int i = ; i < ; ++i){
- if(isPrime[i]){
- for(int j = i; i*j < ; ++j){
- isPrime[i*j] = false;
- }
- }
- }
- }
- void bfs(){
- memset(vis, , sizeof(vis));
- vis[m] = ;
- queue<int> q;
- q.push(m);
- while(!q.empty()){
- int k = q.front();
- q.pop();
- int d[] = {k/, k%/, k%/, k%};
- int b[] = {, , , };
- for(int i = ; i < ; ++i){
- for(int j = ; j < ; ++j){
- int t = k - d[i] * b[i] + j * b[i];
- if(k == n) return ;
- if(t > && isPrime[t] && !vis[t]){
- vis[t] = vis[k] + ;
- q.push(t);
- }
- }
- }
- }
- return ;
- }
- int main(){
- ios::sync_with_stdio(false);
- preprocess();
- int t;
- cin >> t;
- while(t--){
- cin >> m >> n;
- bfs();
- if(vis[n]) cout << vis[n]- << endl;
- else cout << "Impossible" << endl;
- }
- return ;
- }
G 水 直接模拟 略坑是第一张都是最底的一张
- #include <set>
- #include <string>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main(){
- int t;
- cin >> t;
- for(int x = ; x <= t; ++x){
- int l;
- cin >> l;
- string str1, str2, desstr;
- cin >> str1 >> str2 >> desstr;
- int step = ;
- set<string> s;
- s.insert(str1+str2);
- bool flag = true;
- while(flag){
- string tmpstr;
- for(int i = ; i < l; ++i){
- tmpstr += str2[i];
- tmpstr += str1[i];
- }
- //cout << tmpstr << endl;
- ++step;
- if(tmpstr == desstr) break;
- if(s.count(tmpstr)){
- flag = false;
- break;
- }
- s.insert(tmpstr);
- str1 = tmpstr.substr(, l);
- str2 = tmpstr.substr(l, *l);
- //cout << str1 << " " << str2 << endl;
- }
- cout << x << ' ' << (flag ? step : -) << endl;
- }
- return ;
- }
H M题写吐了H不想做.......
还是搜 6种状态
I 暴力找两个#搜.......
- #include <queue>
- #include <cstdio>
- #include <cstring>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- const int INF = 0x3f3f3f;
- const int cx[] = {, , , -};
- const int cy[] = {, -, , };
- int n, m;
- int dis[][];
- char map[][];
- struct Point{
- int x, y;
- Point(){}
- Point(int xx, int yy) :x(xx), y(yy){}
- };
- queue<Point> q;
- int bfs(int x1, int y1, int x2, int y2){
- memset(dis, INF, sizeof(dis));
- q.push(Point(x1, y1));
- q.push(Point(x2, y2));
- dis[x1][y1] = ;
- dis[x2][y2] = ;
- while (!q.empty()){
- Point p = q.front();
- q.pop();
- for (int i = ; i < ; i++){
- int xx = p.x + cx[i], yy = p.y + cy[i];
- if (xx >= && xx < n && yy >= && yy<m && map[xx][yy] == '#' && dis[xx][yy] > dis[p.x][p.y] + ){
- dis[xx][yy] = dis[p.x][p.y] + ;
- q.push(Point(xx, yy));
- }
- }
- }
- int ret = ;
- for (int i = ; i < n; i++)
- for (int j = ; j < m; j++)
- if (map[i][j] == '#')
- ret = max(ret, dis[i][j]);
- return ret;
- }
- int main(){
- int t;
- cin >> t;
- for (int x = ; x <= t; x++){
- while(!q.empty()) q.pop();
- cin >> n >> m;
- for (int i = ; i < n; i++)
- cin >> map[i];
- int ans = INF;
- for (int i = ; i < n; i++)
- for (int j = ; j < m; j++)
- if (map[i][j] == '#')
- for (int ii = ; ii < n; ii++)
- for (int jj = ; jj < m; jj++)
- if (map[ii][jj] == '#'){
- int temp = bfs(i, j, ii, jj);
- ans = min(ans, temp);
- }
- if (ans == INF) ans = -;
- cout << "Case " << x << ": " << ans << endl;
- }
- return ;
- }
J 多处火.....先处理火,再处理人,遇到可行的情况退出来
- #include <bits/stdc++.h>
- using namespace std;
- struct pos{
- int x, y;
- pos(int xx = , int yy = ): x(xx), y(yy) {}
- };
- const int MAXN = ;
- const int INF = 0x7f7f7f7f;
- const int cx[] = {, , , -};
- const int cy[] = {, -, , };
- int n, m;
- int jx, jy, fx, fy;
- int maze[MAXN][MAXN];
- int jstep[MAXN][MAXN];
- int fstep[MAXN][MAXN];
- int main(){
- int t;
- cin >> t;
- while(t--){
- cin >> n >> m;
- queue<pos> qf;
- memset(fstep, -, sizeof(fstep));
- for(int i = ; i < n; ++i){
- cin.get();
- for(int j = ; j < m; ++j){
- char ch;
- cin >> ch;
- if(ch == '#') maze[i][j] = ;
- else{
- maze[i][j] = ;
- if(ch == 'J'){
- jx = i;
- jy = j;
- }
- else if(ch == 'F'){
- fx = i;
- fy = j;
- qf.push(pos(fx, fy));
- fstep[fx][fy] = ;
- }
- }
- }
- }
- while(!qf.empty()){
- pos p = qf.front();
- int x = p.x, y = p.y;
- qf.pop();
- for(int i = ; i < ; ++i){
- int nx = x + cx[i], ny = y + cy[i];
- if(nx < || n <= nx || ny < || m <= ny || maze[nx][ny] == || fstep[nx][ny] != -) continue;
- qf.push(pos(nx, ny));
- fstep[nx][ny] = fstep[x][y] + ;
- }
- }
- // cout << endl;
- // for(int i = 0; i < n; ++i){
- // for(int j = 0; j < m; ++j)
- // cout << fstep[i][j] << '\t';
- // cout << endl;
- // }
- memset(jstep, -, sizeof(jstep));
- queue<pos> qj;
- qj.push(pos(jx, jy));
- jstep[jx][jy] = ;
- int ans = -;
- while(!qj.empty()){
- pos p = qj.front();
- int x = p.x, y = p.y;
- qj.pop();
- if(x == || x == n- || y == || y == m-){
- ans = jstep[x][y];
- break;
- }
- for(int i = ; i < ; ++i){
- int nx = x + cx[i], ny = y + cy[i];
- if(nx < || n <= nx || ny < || m <= ny || maze[nx][ny] == || jstep[nx][ny] != - || (fstep[nx][ny] != - && fstep[nx][ny] <= jstep[x][y] + )) continue;
- qj.push(pos(nx, ny));
- jstep[nx][ny] = jstep[x][y] + ;
- }
- }
- // cout << endl;
- // for(int i = 0; i < n; ++i){
- // for(int j = 0; j < m; ++j)
- // cout << jstep[i][j] << '\t';
- // cout << endl;
- // }
- if(ans == -) cout << "IMPOSSIBLE" << endl;
- else cout << ans+ << endl;
- }
- return ;
- }
K 搜 开数组记录上一个点的坐标
- #include <map>
- #include <set>
- #include <queue>
- #include <deque>
- #include <cmath>
- #include <stack>
- #include <string>
- #include <vector>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <utility>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- struct point{
- int x, y;
- };
- int maze[][];
- point state[][];
- const int cx[] = {, , , -};
- const int cy[] = {, -, , };
- int main(){
- ios::sync_with_stdio(false);
- memset(state, , sizeof(state));
- for(int i = ; i < ; ++i)
- for(int j = ; j < ; ++j)
- cin >> maze[i][j];
- queue<point> q;
- q.push({, });
- maze[][] = ;
- bool flag = false;
- while(!q.empty()){
- point k = q.front();
- q.pop();
- for(int i = ; i < ; ++i){
- int x = k.x + cx[i], y = k.y + cy[i];
- if(x < || x > || y < || y > || maze[x][y]) continue;
- q.push({x, y});
- maze[x][y] = ;
- state[x][y] = k;
- if(x == && y == ){
- flag = true;
- break;
- }
- }
- if(flag) break;
- }
- point k = {, };
- stack<point> s;
- while(!(k.x == && k.y == )){
- s.push(k);
- k = state[k.x][k.y];
- }
- s.push(point{, });
- while(!s.empty()){
- cout << "(" << s.top().x << ", " << s.top().y << ")" << endl;
- s.pop();
- }
- return ;
- }
L 数水坑类的 8个方向
- #include <cstdio>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int ans;
- char maze[][];
- const int cx[] = {, , , , , -, -, -};
- const int cy[] = {, -, , -, , , , -};
- void dfs(int x, int y){
- maze[x][y] = '*';
- for(int i = ; i < ; ++i){
- int nx = x + cx[i], ny = y + cy[i];
- if(maze[nx][ny] == '@') dfs(nx, ny);
- }
- }
- int main(){
- ios::sync_with_stdio(false);
- int m, n;
- while(cin >> m >> n){
- if(m == && n == ) break;
- ans = ;
- for(int i = ; i < m; ++i){
- cin.get();
- for(int j = ; j < n; ++j)
- cin >> maze[i][j];
- }
- for(int i = ; i < m; ++i){
- for(int j = ; j < n; ++j){
- if(maze[i][j] == '@'){
- ++ans;
- dfs(i, j);
- }
- }
- }
- cout << ans << endl;
- }
- return ;
- }
M 可乐.....改了好久蜜汁哇 果断重写 简直恶心
- #include <bits/stdc++.h>
- using namespace std;
- //#define print() cout<<ts<<" "<<tn<<" "<<tm<<endl;
- struct state{
- int s, n, m;
- state(int ss = , int nn = , int mm = ): s(ss), n(nn), m(mm) {}
- };
- int s, n, m;
- queue<state> q;
- const int MAXN = ;
- int step[MAXN][MAXN][MAXN];
- int main(){
- while(cin >> s >> n >> m){
- if(s == && n == && m == ) break;
- if(s & ) cout << "NO" << endl;
- else{
- while(!q.empty()) q.pop();
- memset(step, -, sizeof(step));
- int ans = -;
- q.push(state(s, , ));
- step[s][][] = ;
- while(!q.empty()){
- state p = q.front();
- q.pop();
- int ss = p.s, nn = p.n, mm = p.m;
- if((ss == s/ && nn == s/) || (ss == s/ && mm == s/) || (nn == s/ && mm == s/)){
- ans = step[ss][nn][mm];
- break;
- }
- state tmp;
- //s -> n || s -> m
- if(ss){
- //s -> n
- if(ss > n - nn){
- tmp.s = ss - (n - nn);
- tmp.n = n;
- tmp.m = mm;
- }
- else{
- tmp.s = ;
- tmp.n = nn + ss;
- tmp.m = mm;
- }
- if(step[tmp.s][tmp.n][tmp.m] == -){
- step[tmp.s][tmp.n][tmp.m] = step[ss][nn][mm] + ;
- q.push(tmp);
- }
- //ss -> m
- if(ss > m - mm){
- tmp.s = ss - (m - mm);
- tmp.m = m;
- tmp.n = nn;
- }
- else{
- tmp.s = ;
- tmp.m = mm + ss;
- tmp.n = nn;
- }
- if(step[tmp.s][tmp.n][tmp.m] == -){
- step[tmp.s][tmp.n][tmp.m] = step[ss][nn][mm] + ;
- q.push(tmp);
- }
- }
- //n -> s || n -> m
- if(nn){
- //n -> s
- if(nn > s - ss){
- tmp.n = nn - (s - ss);
- tmp.s = s;
- tmp.m = mm;
- }
- else{
- tmp.n = ;
- tmp.s = ss + nn;
- tmp.m = mm;
- }
- if(step[tmp.s][tmp.n][tmp.m] == -){
- step[tmp.s][tmp.n][tmp.m] = step[ss][nn][mm] + ;
- q.push(tmp);
- }
- //n -> m
- if(nn > m - mm){
- tmp.n = nn - (m - mm);
- tmp.m = m;
- tmp.s = ss;
- }
- else{
- tmp.n = ;
- tmp.m = mm + nn;
- tmp.s = ss;
- }
- if(step[tmp.s][tmp.n][tmp.m] == -){
- step[tmp.s][tmp.n][tmp.m] = step[ss][nn][mm] + ;
- q.push(tmp);
- }
- }
- //m -> n || m -> s
- if(mm){
- //m -> n
- if(mm > n - nn){
- tmp.m = mm - (n - nn);
- tmp.n = n;
- tmp.s = ss;
- }
- else{
- tmp.m = ;
- tmp.n = nn + mm;
- tmp.s = ss;
- }
- if(step[tmp.s][tmp.n][tmp.m] == -){
- step[tmp.s][tmp.n][tmp.m] = step[ss][nn][mm] + ;
- q.push(tmp);
- }
- //m -> s
- if(mm > s - ss){
- tmp.m = mm - (s - ss);
- tmp.s = s;
- tmp.n = nn;
- }
- else{
- tmp.m = ;
- tmp.s = mm + ss;
- tmp.n = nn;
- }
- if(step[tmp.s][tmp.n][tmp.m] == -){
- step[tmp.s][tmp.n][tmp.m] = step[ss][nn][mm] + ;
- q.push(tmp);
- }
- }
- }
- if(ans == -) cout << "NO" << endl;
- else cout << ans << endl;
- }
- }
- return ;
- }
N 从两个人的位置开始bfs整个图
- #include <queue>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <vector>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- struct pos{
- int x, y;
- pos(int xx, int yy): x(xx), y(yy){};
- };
- const int MAXN = ;
- char maze[MAXN][MAXN];
- const int cx[] = {, -, , };
- const int cy[] = {, , , -};
- vector<pos> kfc;
- queue<pos> qy; int yx, yy, stepy[MAXN][MAXN];
- queue<pos> qm; int mx, my, stepm[MAXN][MAXN];
- int main(){
- int n, m;
- while(cin >> n >> m){
- kfc.clear();
- for(int i = ; i < n; ++i){
- cin.get();
- for(int j = ; j < m; ++j){
- char ch;
- cin >> ch;
- if(ch == '#') maze[i][j] = ch;
- else{
- if(ch == 'Y'){
- yx = i;
- yy = j;
- }
- if(ch == 'M'){
- mx = i;
- my = j;
- }
- if(ch == '@')
- kfc.push_back(pos(i, j));
- maze[i][j] = '.';
- }
- }
- }
- while(!qy.empty()) qy.pop();
- while(!qm.empty()) qm.pop();
- memset(stepy, -, sizeof(stepy));
- memset(stepm, -, sizeof(stepm));
- qy.push(pos(yx, yy));
- stepy[yx][yy] = ;
- while(!qy.empty()){
- int x = qy.front().x, y = qy.front().y;
- qy.pop();
- for(int i = ; i < ; ++i){
- int nx = x + cx[i], ny = y + cy[i];
- if(nx < || n < nx || ny < || m < ny || maze[nx][ny] == '#' || stepy[nx][ny] != -) continue;
- stepy[nx][ny] = stepy[x][y] + ;
- qy.push(pos(nx, ny));
- }
- }
- qm.push(pos(mx, my));
- stepm[mx][my] = ;
- while(!qm.empty()){
- int x = qm.front().x, y = qm.front().y;
- qm.pop();
- for(int i = ; i < ; ++i){
- int nx = x + cx[i], ny = y + cy[i];
- if(nx < || n < nx || ny < || m < ny || maze[nx][ny] == '#' || stepm[nx][ny] != -) continue;
- stepm[nx][ny] = stepm[x][y] + ;
- qm.push(pos(nx, ny));
- }
- }
- int ans = 0x7f7f7f7f;
- for(vector<pos>::iterator i = kfc.begin(); i != kfc.end(); ++i){
- int x = (*i).x, y = (*i).y;
- ans = min(ans, stepy[x][y] + stepm[x][y]);
- }
- cout << ans* << endl;
- }
- return ;
- }
.............................................................................
kuangbin专题一 简单搜索的更多相关文章
- [kuangbin带你飞]专题一 简单搜索 题解报告
又重头开始刷kuangbin,有些题用了和以前不一样的思路解决.全部题解如下 点击每道题的标题即可跳转至VJ题目页面. A-棋盘问题 棋子不能摆在相同行和相同列,所以我们可以依此枚举每一行,然后标记每 ...
- [kuangbin带你飞]专题一 简单搜索(回顾)
A - 棋盘问题 POJ - 1321 注意条件:不能每放一个棋子,就标记一行和一列,我们直接枚举每一行就可以了. AC代码: #include<iostream> #include< ...
- kuangbin专题 专题一 简单搜索 Oil Deposits HDU - 1241
题目链接:https://vjudge.net/problem/HDU-1241 题意:问有几个油田,一个油田由相邻的‘@’,组成. 思路:bfs,dfs都可以,只需要遍历地图,遇到‘@’,跑一遍搜索 ...
- kuangbin专题 专题一 简单搜索 迷宫问题 POJ - 3984
题目链接:https://vjudge.net/problem/POJ-3984 这个题目,emm,上代码,看的估计应该是刚开始接触搜索的,我带点注释,你能慢慢理解. #include <ios ...
- kuangbin专题 专题一 简单搜索 Fire! UVA - 11624
题目链接:https://vjudge.net/problem/UVA-11624 题意:一个迷宫,可能有一个或者多个地方着火了,每过1个时间消耗,火会向四周蔓延,问Joe能不能逃出迷宫,只要走出迷宫 ...
- kuangbin专题 专题一 简单搜索 Fliptile POJ - 3279
题目链接:https://vjudge.net/problem/POJ-3279 题意:格子有两面,1表示黑色格子,0表示白色格子,奶牛每次可以踩一个格子,踩到的格子和它周围的上下左右格子都会翻面,也 ...
- kuangbin专题 专题一 简单搜索 Shuffle'm Up POJ - 3087
题意:(1)有两副颜色多样的扑克牌,(A~H)表示不同颜色,给你两副牌,S1,S2和一副你需要洗出的KEY,S12由S2最底部,S1底部...一直下去,直到洗成S12,就是图片展示的那样.(2)洗好的 ...
- kuangbin专题 专题一 简单搜索 Prime Path POJ - 3126
题目链接:https://vjudge.net/problem/POJ-3126 题意:给你两个四位的素数N,M,每次改变N四位数中的其中一位,如果能经过有限次数的替换变成四位数M,那么求出最少替换次 ...
- kuangbin专题 专题一 简单搜索 Dungeon Master POJ - 2251
题目链接:https://vjudge.net/problem/POJ-2251 题意:简单的三维地图 思路:直接上代码... #include <iostream> #include & ...
随机推荐
- JavaScript修改Canvas图片
用JavaScript修改Canvas图片的分辨率(DPI) 应用场景: 仓库每次发货需要打印标签, Canvas根据从数据库读取的产品信息可以生成标签JPG, 但是这个JPG图片的默认分辨率(D ...
- 街景地图 API
SOSO街景地图 API (Javascript)开发教程(1)- 街景 SOSO街景地图 Javascript API 干什么用的? 你想在网页里嵌入个地图,就需要它了! 另外,它还支持:地点搜 ...
- HTTP状态码的意义
100系列码 从100到199范围的HTTP状态码是信息报告码.基于各种原因考虑,大多数情况下我们是 很少看见这些代码的.首先,如果一个浏览器尝试访问一个网站,而网站返回这些代码时,它们往往都不会显示 ...
- ASP.NET MVC4简单使用ELMAH记录系统日志
ASP.NET MVC4简单使用ELMAH记录系统日志 前言 在项目开发.测试以及已经上线的项目中都会存在bug,而如果我们在项目的各个阶段都能及时的监控系统出现的任何问题,那么对于我们开发人员来说完 ...
- .net基础收集
.net基础收集 最近的面试让我知道基础知识的重要性,而我也每天都在网上找一些基础题来看.其实面试无非都是一些理论基础,只有基础过关了,才会被问到技术性的问题,所以第一关一定要打好.下面是我收集的一些 ...
- 一步一步深入spring(7)-- 整合spring和JDBC的环境
1.配置数据源 (1).添加支持数据源的jar包commons-dbcp.jar .commons-pool.jar 当然也要添加其他的spring用到的jar以及这里用到的数据库mysql的jar ...
- CKEditor 自主控制图片上传
在ASP.NET中使用CKEditor编辑器,如果想控制图片上传,即把上传的图片路径名存到数据中,可以自定义一个上传功能 首先自定义CKEditor的配置文件 在config.js中添加以下代码,红色 ...
- [置顶] “河软CSDN2011级表彰暨实习动员大会”顺利召开!
9点30分 伴随着激昂的开场曲,主持人走到台前!“河软CSDN2011级表彰暨 实习动员大会即将开始,请各位嘉宾入场!”他们分别是“CSDN教育事业部总经 理李天山先生”“河北软件职业技术学院 软件工 ...
- 使用MFC CImage类绘制PNG图片时遇到的问题
为了测试CImage绘制PNG图片的效果,我们用截图软件截得一张360的界面,然后使用PhotoShop等工具在图片的周边加上了透明的区域,然后保存成PNG图片文件.CImage首先从文件中加载,即 ...
- CCNA网络工程师学习进程(7)路由器的路由配置
前面一节已经介绍了路由器的端口配置,接着我们介绍路由器的路由配置:静态路由.默认路由和浮动路由的配置:动态路由协议的配置,包括RIP.IGRP.EIGRP和OSPF. (1)路由器的基 ...