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的更多相关文章

  1. UVA 11040 Add bricks in the wall(线性组合)

    砖块上的数字最终都可以看作是最后一行的线性组合,独立变元最多9个. 这类题的一般做法,线性组合都可以列出方程然后高斯消元. 对于这道题,只要确定最后一行剩下的4个变量就好了,对于最后一行的j位置,它对 ...

  2. UVa 11040 Add bricks in the wall (水题递推)

    题意:给定一个金字塔,除了最后一行,每个数都等于支撑它的两个数的和,现在给奇数行的左数奇数位置,求整个金字塔. 析:很容易看出来,从下往上奇数行等于 a[i][j] = (a[i-2][j-1] - ...

  3. UVa 11040 (水题) Add bricks in the wall

    题意: 45块石头如图排列,每块石头上的数等于下面支撑它的两数之和,求其余未表示的数. 分析: 首先来计算最下面一行的数,A71 = A81 + A82 = A91 + 2A92 + A93,变形得到 ...

  4. 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 ...

  5. 【NOIP合并果子】uva 10954 add all【贪心】——yhx

    Yup!! The problem name reects your task; just add a set of numbers. But you may feel yourselvesconde ...

  6. 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 ...

  7. UVA 10954 Add All 哈夫曼编码

    题目链接: 题目 Add All Time Limit:3000MS Memory Limit:0KB 问题描述 Yup!! The problem name reflects your task; ...

  8. 【数论-数位统计】UVa 11076 - Add Again

    Add AgainInput: Standard Input Output: Standard Output Summation of sequence of integers is always a ...

  9. UVa 10954 Add All(优先队列)

    题意  求把全部数加起来的最小代价  a+b的代价为(a+b) 越先运算的数  要被加的次数越多  所以每次相加的两个数都应该是剩下序列中最小的数  然后结果要放到序列中  也就是优先队列了 #inc ...

随机推荐

  1. 从hive导入到oracle(Hcatalog)

    1.使用catalog的情况下: sqoop export --table tableName2 \ #oracle表 --connect jdbc:oracle:thin:@127.0.0.1:15 ...

  2. python3 bytes与hex_string之间的转换

    1, bytes to hex_string的转换: def byte_to_hex(bins): """ Convert a byte string to it's h ...

  3. 《剑指Offer》题一~题十

    一.赋值运算符函数 题目:如下为类型CMyString的声明,请为该类型添加赋值运算符函数. class CMyString { public: CMyString(char *pData = nul ...

  4. ueditor百度编辑器的赋值方法

    示例: http://ueditor.baidu.com/website/onlinedemo.html 引用代码: window.UMEDITOR_HOME_URL = $CONFIG['domai ...

  5. UVA725 Division (暴力求解法入门)

    uva 725 Division Write a program that finds and displays all pairs of 5-digit numbers that between t ...

  6. ava中普通代码块,构造代码块,静态代码块区别及示例

    //执行顺序:(优先级从高到低.)静态代码块>mian方法>构造代码块>构造方法. 其中静态代码块只执行一次.构造代码块在每次创建对象是都会执行. 1 普通代码块 //普通代码块:在 ...

  7. j2ee—框架(1):Servlet+JSP实现基本的登录功能(v1.0)

    主要分为四个部分:LoginController.web.xml.login.jsp和login_success.jsp(login_fail.jsp). 第一部分 LoginController p ...

  8. css那些事儿3 列表与浮动

    一  列表 列表默认为行内块元素,具有宽高,当一个非块元素是无法应用宽高的,比如a 1 有序列表 有ol li组成,其中li为列表项,列表的ol子元素务必为li元素标签,li子内容支持列表任意嵌套,有 ...

  9. 【Docker 命令】- run命令

    docker run :创建一个新的容器并运行一个命令 语法: docker run [OPTIONS] IMAGE [COMMAND] [ARG...] OPTIONS说明: -a stdin: 指 ...

  10. 请问:在delphi中怎样判断DBgrid中数据是否被修改,以便在退出窗口时加以提示

    若DBGrid.DataSource.DateSet为ADOQuery1,这样试一下:if ADOQuery1.Modified then ... procedure TForm1.FormClose ...