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. 排序算法:快速排序解析及Python实现

    关键词:分而治之.递归.计算速度.基准值 1. 什么是分而治之? 1.1 分而治之(divide and conquer)一种递归式方法 1.2 找出基线条件,这种条件必须尽可能简单 1.3 不断将问 ...

  2. 4013: [HNOI2015]实验比较

    4013: [HNOI2015]实验比较 链接 分析: 首先把等号用并查集合并起来. 由于只存在最多一个质量不比i差的数,发现这是森林.若x<y,连边x->y.于是建虚拟根节点0. 然后树 ...

  3. java 继承类之后,访问不到超类的属性的原因及解决方法

    是因为超类里的属性没有加上public关键字 解决方法: 超类和超类里的属性或者方法如果想被其他包下的方法调用,就必须全部加上public权限,即设置为公开访问 例: @Controller publ ...

  4. HTML5上的LocalStorage基本用法

    1.获取localStorage的长度:window.localStorage.length 2.添加/编辑localStorage的内容:window.localStorage.setItem(键, ...

  5. String与Date的互相转换

    SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 也可以: SimpleDateFormat sd ...

  6. 3.PO如何给开发团队讲好故事

    敏捷开发系列文章目录 讲出符合开发团队味口的故事. 上一章说了敏捷开发团队的构成与迭代过程,本章重点说一下迭代第一天的计划会议.熟话说“好的开始就成功了一半”,一个迭代的计划会议做得好不好确实直接注定 ...

  7. Python中的异常(Exception)处理

    异常 当你的程序出现例外情况时就会发生异常(Exception).例如,当你想要读取一个文件时,而那个文件却不存在,怎么办?又或者你在程序执行时不小心把它删除了,怎么办?这些通过使用异常来进行处理. ...

  8. 六度空间(MOOC)

    六度空间: “六度空间”理论又称作“六度分隔(Six Degrees of Separation)”理论.这个理论可以通俗地阐述为:“你和任何一个陌生人之间所间隔的人不会超过六个,也就是说,最多通过五 ...

  9. docker入门使用教程

    Docker概念 Docker是开发人员和系统管理员 使用容器开发,部署和运行应用程序的平台.使用Linux容器部署应用程序称为容器化.容器不是新的,但它们用于轻松部署应用程序. 容器化越来越受欢迎, ...

  10. node jade模板数据库操作

    /* Navicat MySQL Data Transfer Source Server         : localhost Source Server Version : 50519 Sourc ...