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. 1、算法介绍,lowB三人组,快速排序

    1.什么是算法 2.递归 # 一直递归,递归完成再打印 def func4(x): if x > 0: func4(x - 1) print(x) func4(5) 3.时间 复杂度 (1)引入 ...

  2. com.jcraft.jsch.JSchException: java.io.FileNotFoundException: file:\D:\development\ideaProjects\salary-card\target\salary-card-0.0.1-SNAPSHOT.jar!\BOOT-INF\classes!\keystore\login_id_rsa 资源未找到

    com.jcraft.jsch.JSchException: java.io.FileNotFoundException: file:\D:\development\ideaProjects\sala ...

  3. python面试题(二)

    最近参加了几场招聘,发现好多人的一些基础知识不是很扎实,做的题很多都是错误的,因此找了一些我们公司面试过程中的一些最基本的面试题供大家参考,希望各位都能找到一个好的工作.今天给大家先分享的是关于Pyt ...

  4. 微信小程序中的 hover-class

    微信小程序中,可以用 hover-class 属性来指定元素的点击态效果.但是在在使用中要注意,大部分组件是不支持该属性的. 目前支持 hover-class 属性的组件有三个:view.button ...

  5. Java将List<T>集合组装成树(Tree)树结构组装

    把列表转换为树结构 /** * 把列表转换为树结构 * * @param originalList 原始list数据 * @param keyName 作为唯一标示的字段名称 * @return 组装 ...

  6. Web服务架构

    # Web服务架构 ### Web服务模型-- 服务提供者.服务请求者.服务注册中心,服务注册中心是一个可选的角色. 现在的Web服务不仅限于WSDL,还有RESTful. - 服务提供者.即Web服 ...

  7. Influxdb配置文件详解---influxdb.conf

    官方介绍:https://docs.influxdata.com/influxdb/v1.2/administration/config/ 全局配置 1 2 reporting-disabled =  ...

  8. Linear Regression and Maximum Likelihood Estimation

    Imagination is an outcome of what you learned. If you can imagine the world, that means you have lea ...

  9. wifi,Android渗透之arp欺骗

    查看自己wifi ip段 查看有哪些用户连接了此wifi,下图标记处为我的测试机(华为) 攻击开始,如果开启了arp防火墙,就会有提示 开启图片捕获

  10. python其他知识目录

    博客目录总纲首页 基础的重要性(程序员之路) 做一个“合格”的程序员(一)——基础能力 作为一个程序员,数学对你到底有多重要 同样是程序员,为什么别人比你更优秀? ------------------ ...