http://acm.hdu.edu.cn/showproblem.php?pid=2123

Problem Description
In this problem you need to make a multiply table of N * N ,just like the sample out. The element in the ith row and jth column should be the product(乘积) of i and j.
 
Input
The first line of input is an integer C which indicate the number of test cases.

Then C test cases follow.Each test case contains an integer N (1<=N<=9) in a line which mentioned above.

 
Output
For each test case, print out the multiply table.
 
Sample Input
2
1
4
 
Sample Output
1
1 2 3 4
2 4 6 8
3 6 9 12
4 8 12 16

代码:

#include <bits/stdc++.h>
using namespace std; int num[10][10]; int main() {
int T;
scanf("%d", &T);
while(T --) {
int x;
scanf("%d", &x); for(int i = 1; i <= x; i ++) {
for(int j = 1; j <= x; j ++)
num[i][j] = i * j;
} for(int i = 1; i <= x; i ++) {
for(int j = 1; j <= x; j ++) {
if(j != x)
printf("%d ", num[i][j]);
else
printf("%d\n", num[i][j]);
}
} }
return 0;
}

  

HDU 2123 An easy problem的更多相关文章

  1. HDOJ(HDU) 2123 An easy problem(简单题...)

    Problem Description In this problem you need to make a multiply table of N * N ,just like the sample ...

  2. hdu 5475 An easy problem(暴力 || 线段树区间单点更新)

    http://acm.hdu.edu.cn/showproblem.php?pid=5475 An easy problem Time Limit: 8000/5000 MS (Java/Others ...

  3. HDU 5475 An easy problem 线段树

    An easy problem Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pi ...

  4. 数据结构(主席树):HDU 4729 An Easy Problem for Elfness

    An Easy Problem for Elfness Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65535/65535 K (J ...

  5. HDU 2132 An easy problem

    http://acm.hdu.edu.cn/showproblem.php?pid=2132 Problem Description We once did a lot of recursional ...

  6. HDOJ(HDU) 2132 An easy problem

    Problem Description We once did a lot of recursional problem . I think some of them is easy for you ...

  7. hdu 2055 An easy problem (java)

    问题: 開始尝试用字符做数组元素.可是并没实用. 在推断语句时把a z排出了. An easy problem Time Limit: 1000/1000 MS (Java/Others)    Me ...

  8. HDU 4729 An Easy Problem for Elfness (主席树,树上第K大)

    转载请注明出处,谢谢http://blog.csdn.net/ACM_cxlove?viewmode=contents    by---cxlove 题意:给出一个带边权的图.对于每一个询问(S , ...

  9. HDU - 3521 An easy Problem(矩阵快速幂)

    http://acm.hdu.edu.cn/showproblem.php?pid=3521 题意 对于矩阵A,求e^A的值. 分析 这个定眼一看好像很熟悉,就是泰勒展开,可惜自己的高数已经还给老师了 ...

随机推荐

  1. BZOJ2120_数颜色_KEY

    题目传送门 裸的带修莫队. 在Sort时如果左右区间都在同一块中,就按询问的修改的先后Sort. 对于每次查询判断向前或向后修改. 当size为N*2/3时据说是最优.O(N^(3/5)). code ...

  2. Oracle中实现dblink的作法

    基本环境: 机器1: 192.168.56.102  用作dblink的使用者(create database link 语句在此执行) 机器2: 192.168.56.103  用作dblink的源 ...

  3. c++ goto语句

    #include <stdio.h> #include <math.h> int main(void) //main是程序入口 { int num; printf(" ...

  4. 用matplotlib获取雅虎股票数据并作图

    matplotlib有一个finance子模块提供了一个获取雅虎股票数据的api接口:quotes_historical_yahoo_ochl 感觉非常好用! 示例一 获取数据并作折线图 import ...

  5. Java Swing:JPanel中添加JPanel

    1. JPanel默认布局是FlowLayout,如果不设置父JPanel的布局,则子JPanel自动填满父JPanel. JPanel jpanel = new JPanel(); jpanel.s ...

  6. Dbzoj#3188. [Coci 2011]Upit

    写道数据结构练练手哈哈哈 // It is made by XZZ #include<cstdio> #include<algorithm> #include<cstdl ...

  7. cogs1889 [SDOI2008]Cave 洞穴勘测 link-cut tree

    link-cut tree // It is made by XZZ #include<cstdio> #include<algorithm> #define il inlin ...

  8. 四 Hive整合HBase

    安装环境: hbase版本:hbase-1.4.0-bin.tar.gz hive版本:   apache-hive-1.2.1-bin.tar 注意请使用高一点的hbase版本,不然就算hive和h ...

  9. Flutter - 左右侧滑菜单:drawer和endDrawer

    侧滑菜单可以从左面滑出,也可以从右面滑出.在Scaffold中有drawer和endDrawer两个参数,分别对应左边的菜单和右边的菜单. drawer: new Drawer( child: new ...

  10. SpringBoot日记——按钮的高亮和添加篇

    场景如下: 我们点击主页,主页那个按钮就高亮: 我们点击员工,员工那个按钮就高亮: 高亮的处理 直接来看代码如何编写: 1.先看一下官方文档如何编写关于参数配置的,等下我们来解释为何这么写: 所以,我 ...