UVA1426-Add Bricks in The Wall
来源:互联网 发布:linux挂载ntfs 只读 编辑:程序博客网 时间:2024/05/16 15:34
需要简单的分析一下,上两层的值可以通过隔一层来判断。
#include<iostream>#include<cstring>#include<cstdio>#include<math.h>#include<vector>#include<algorithm>#include<queue>#include<set>using namespace std;int a[11][11];int main(){ int t; scanf("%d",&t);; while(t--) { for(int i=1;i<=9;i+=2) for(int j=1;j<=i;j+=2) scanf("%d",&a[i][j]); for(int i=9;i>=2;i--){ if(i%2==1){ for(int j=2;j<=i-1;j+=2) a[i][j]=(a[i-2][j-1]-a[i][j-1]-a[i][j+1])/2; } else{ for(int j=1;j<=i;j++) a[i][j]=a[i+1][j]+a[i+1][j+1]; } } for(int ii=1;ii<=9;ii++){ for(int jj=1;jj<=ii;jj++) printf(jj!=ii?"%d ":"%d\n",a[ii][jj]); } } return 0;}
0 0
- UVA1426-Add Bricks in The Wall
- UVa11040 - Add bricks in the wall
- UVA 11040 - Add bricks in the wall
- UVa 11040 - Add bricks in the wall
- UVA11040 - Add bricks in the wall
- UVa 11040 - Add bricks in the wall
- uva 11040 - Add bricks in the wall
- UVA 11040 Add bricks in the wall
- UVa 11040 - Add bricks in the wall
- Add bricks in the wall UVA
- Add bricks in the wall UVA
- 【UVA】11040 - Add bricks in the wall(找规律)
- UVa 11040 - Add bricks in the wall(规律)
- UVa11040 - Add bricks in the wall (规律递推)
- 11040 - Add bricks in the wall(简单题)
- 习题10-1 11040 Add bricks in the wall 砌砖
- UVA 11040(p342)----Add Bricks in the Wall
- UVA-11040-Add Bricks in the wall(规律、递推)
- Hibernate 持久化状态、HQL语句大全(转)
- Android Message和obtainMessage的区别
- RabbitMq、ActiveMq、ZeroMq、kafka之间的比较,资料汇总
- [leetcode] 87.Scramble String
- 移动端CSS Reset
- UVA1426-Add Bricks in The Wall
- 基于二叉搜索树的符号表和BST排序
- c++ primer plus 第五章《编程题5.9.4》
- Mysql 12 复制1
- ZOJ 3703 Happy Programming Contest
- 硬件十万个为什么——运放篇(四)微弱信号放大技巧
- hust Distinct Primes
- 最短路径—Dijkstra算法和Floyd算法
- 终于可以玩了,可以看电视,可以玩游戏