UVA 11040 Add bricks in the wall
https://vjudge.net/problem/UVA-11040
找规律
#include<cstdio>
using namespace std;
int a[][];
int main()
{
int T,d;
scanf("%d",&T);
while(T--)
{
for(int i=;i<=;i++)
for(int j=;j<=i;j++)
scanf("%d",&a[i*-][j*-]);
for(int i=;i<=;i+=)
{
for(int j=;j<=;j+=)
{
a[i][j]=a[i-][j-]-a[i][j-]-a[i][j+]>>;
a[i-][j-]=a[i][j]+a[i][j-];
a[i-][j]=a[i][j]+a[i][j+];
}
}
for(int i=;i<=;i++)
{
printf("%d",a[i][]);
for(int j=;j<=i;j++) printf(" %d",a[i][j]);
printf("\n");
}
}
}
UVA 11040 Add bricks in the wall的更多相关文章
- UVA 11040 Add bricks in the wall(线性组合)
砖块上的数字最终都可以看作是最后一行的线性组合,独立变元最多9个. 这类题的一般做法,线性组合都可以列出方程然后高斯消元. 对于这道题,只要确定最后一行剩下的4个变量就好了,对于最后一行的j位置,它对 ...
- UVa 11040 Add bricks in the wall (水题递推)
题意:给定一个金字塔,除了最后一行,每个数都等于支撑它的两个数的和,现在给奇数行的左数奇数位置,求整个金字塔. 析:很容易看出来,从下往上奇数行等于 a[i][j] = (a[i-2][j-1] - ...
- UVa 11040 (水题) Add bricks in the wall
题意: 45块石头如图排列,每块石头上的数等于下面支撑它的两数之和,求其余未表示的数. 分析: 首先来计算最下面一行的数,A71 = A81 + A82 = A91 + 2A92 + A93,变形得到 ...
- Codeforces Round #676 (Div. 2) XORwice、Putting Bricks in the Wall、Palindromifier
题目链接:XORwice 题意:给你两个数a.b.求一个数x,使得((a异或x)+(b异或x))这个值最小,输出最小那个x 题解: 输出(a|b)-(a&b)就行(猜了一手 代码: #incl ...
- 【NOIP合并果子】uva 10954 add all【贪心】——yhx
Yup!! The problem name reects your task; just add a set of numbers. But you may feel yourselvesconde ...
- UVA 11076 Add Again 计算对答案的贡献+组合数学
A pair of numbers has a unique LCM but a single number can be the LCM of more than one possiblepairs ...
- UVA 10954 Add All 哈夫曼编码
题目链接: 题目 Add All Time Limit:3000MS Memory Limit:0KB 问题描述 Yup!! The problem name reflects your task; ...
- 【数论-数位统计】UVa 11076 - Add Again
Add AgainInput: Standard Input Output: Standard Output Summation of sequence of integers is always a ...
- UVa 10954 Add All(优先队列)
题意 求把全部数加起来的最小代价 a+b的代价为(a+b) 越先运算的数 要被加的次数越多 所以每次相加的两个数都应该是剩下序列中最小的数 然后结果要放到序列中 也就是优先队列了 #inc ...
随机推荐
- Some good articles
https://alligator.io/vuejs/introduction-render-functions/ https://alligator.io/vuejs/vue-jwt-pattern ...
- 接口_GET请求_基于python
1.GET请求(不带参数) # coding:utf-8 import requests r=requests.get("https://www.baidu.com") #r即为r ...
- VBA基础之Excel VBA 表格的操作(一)
一.Excel VBA 表格的操作1. Excel表格的指定以及表格属性的设置 Sub main() '把表格B2的值改为"VBA Range和Cells函数" Range(&qu ...
- Tic-Tac-Toe
Description Kim likes to play Tic-Tac-Toe. Given a current state, and now Kim is going to take his n ...
- 20172330 2017-2018-1 《Java程序设计》第五周学习总结
20172330 2017-2018-1 <Java程序设计>第五周学习总结 教材学习内容总结 第五章 首先是对各种各种运算符的了解:刚开始以为相等就是=,还有其他一些符号都挺简单的,然后 ...
- iOS- Exception异常处理
1.Exception 前言 在iOS里对异常的处理及捕获,并没有其它语言里那么常见,相信很多iOS程序员都知道,更多的时候是对内存的的检测与分析,检测相关内存方面的问题. 而在app闪退并不是因为内 ...
- YaoLingJump开发者日志(九)V1.1.1版本完成
跳跃吧瑶玲下载连接 百度网盘下载 介绍 Android版本升级到8.0,发现原来的图标不显示了: 百度了一下解决方案,用了该博客提供的第二种方法,修改roundIcon的内容. 可爱的图标 ...
- PAT L2-028 秀恩爱分得快
https://pintia.cn/problem-sets/994805046380707840/problems/994805054698012672 古人云:秀恩爱,分得快. 互联网上每天都有大 ...
- phpcms退出 提示 :退出成功0 。 的解决办法
打开/phpcms/modules/member/index.php 搜索如下代码: showmessage(L('logout_success').$synlogoutstr, $forward); ...
- centos升级python(从2.6.6升级到2.7.8)
***先安装readline,否则升级后python回退和方向键不能使用 yum install readline-devel.x86_64 1.#wget www.python.org/ftp/ ...