zoukankan      html  css  js  c++  java
  • [CCF] 201604-2 俄罗斯方块 Apare_xzc

    [CCF] 201604-2 俄罗斯方块


    改了一下我家LH的代码,瞬间AC

    题目:

    在这里插入图片描述
    在这里插入图片描述

    思路:一直往下落,直到碰到障碍停止

    #include<iostream>
    #include<algorithm>
    using namespace std;
    
    int maze[16][10];
    int a[4][4];
    int node[4][2];
    int main(){
    	for(int i=0;i<15;i++){
    		for(int j=0;j<10;j++){
    			cin >> maze[i][j];
    		}
    	}
    	
    	for(int i=0,k=0;i<4;i++){
    		for(int j=0;j<4;j++){
    			cin >> a[i][j];
    			if(a[i][j]){
    				node[k][0] = i;
    				node[k++][1] = j;
    			}
    		}
    	}
    	int n;
    	cin >> n;
    	int row = 0;
    	for(int j=0;j<10;++j) maze[15][j]=1;
    	while(row<16){
    		for(int i=0;i<4;i++){
    			if(maze[row+node[i][0]][n+node[i][1]-1]){
    				goto A;
    			}	
    		}
    		row++;
    	}
    	A:row=row-1;
    	for(int i=0;i<4;i++){
    		maze[row+node[i][0]][n+node[i][1]-1]=1;
    	}
    	
    	 for(int i=0; i<15; i++) {
            for(int j=0; j<10; j++) {
                cout << maze[i][j] << " ";
            }
            cout << endl;
    	}
    	return 0;
    }
    

  • 相关阅读:
    单机部署Fastfds+nginx
    day_ha配置文件
    day_1_登录接口

    表(list)
    Java基础01 ------ 从HelloWorld到面向对象
    测试V模型
    360极速模式和兼容模式区别
    初识VBS
    Bug描述规范
  • 原文地址:https://www.cnblogs.com/Apare-xzc/p/12243619.html
Copyright © 2011-2022 走看看