• 个人简介

    Nothing is impossible as long as you try your best,Because everything is possible!


    一个很屑的代码(似乎有点抽象)

    #未完成的、基于BFS画树的Python代码。
    import turtle
    #import time
    #p=turtle.Turtle()
    #vis = []
    def move(x,y):#自定义
        turtle.penup()
        turtle.goto(x,y)
        turtle.pendown()
        #turtle.dot(3)
    queue=[]#广度优先搜索用到队列,这里用于存储坐标
    #deep =int(input("请输入树的深度:")) #限制迭代深度
    #length = int(input("请输入树枝的长度:")) 
    def draw(angle):
        turtle.setheading(angle)
        turtle.forward(length)
        queue.append(turtle.pos())
        turtle.backward(length)
    deep = 6
    length = 30
    init()
    cnt = 0
    angle = 30 
    queue.append((-100,0))
    i=0
    while cnt <= 2**deep:#BFS
        u=len(queue)
        p = queue[0]
        queue.pop(0)#出队
        move(p[0],p[1])
        x,y=turtle.pos()
        angle = (angle+2)%90
        draw(angle)
        draw(360-angle)
        i+=1
        cnt += 1
    turtle.done()
    

    还有更屑的:

    #include <bits/stdc++.h>
    using namespace std;
    int a[15][15],val[15][15],n,m,T,pos;
    char x;
    struct Node{
    	int x,y;
    }e[15];
    queue <Node> Q;
    bool search(){
        for (int i=1;i<=n;i++){
            for (int j=1;j<=m;j++){
    
            }
        }
        return false;
    }
    int main(){
    	ios::sync_with_stdio(false);
    	cin.tie(0);
    	cout.tie(0);
    	cin>>T;
    	while (T--){
    		cin>>n>>m;
            pos = 0;
    		for (int i=1;i<=n;i++)
    			for (int j=1;j<=m;j++){
    				cin>>x;
    				if (x == '*') a[i][j] = 1;
    				else if (x >= 48 && x<= 57) val[i][j] = x - 48;
    				else e[++pos].x=i,e[++pos].y=j;
    			}
            const int l=pos;
    		bitset<l> bs;
            bool flag = false;
    		for (int i=0;i<(1<<l);i++){
    		    bs = i;
    		    for (int j=0;j<l;j++)
                    a[e[bs[j]].x][e[bs[j]].y] = bs[j];
                if (search()){
                    flag =true;
                    break;
                }
    		}
            (!flag) ? cout<<"YES"<<"\n" : cout<<"NO"<<"\n";
    		memset(a,0,sizeof(a));	
    		memset(val,0,sizeof(val));
    	} 
    	return 0;
    } 
    
  • 通过的题目

  • 最近活动

    This person is lazy and didn't join any contests or homework.
  • 最近编写的题解

    This person is lazy and didn't write any solutions.

题目标签

客观题
1