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. 【BZOJ1041】[HAOI2008]圆上的整点

    [BZOJ1041][HAOI2008]圆上的整点 题面 bzoj 洛谷 题解 不妨设\(x>0,y>0\) \[ x^2+y^2=r^2\\ y^2=(x+r)(x-r) \] 设\(r ...

  2. 菜鸟vimer成长记——第4.0章、Vim插件管理利器-Vundle

    定义 Vundle是vim bunler和简称,它是一个vim插件管理器. Vim本身缺乏对插件的有效管理,安装插件并配置.vimrc文件非常不便.gmarik受到Ruby的bunler的启发,开发了 ...

  3. 异步任务(Celery)详解

    一.背景 在开发中,我们可能经常会遇到一些需要执行时间很长的任务,如果放在前端,会让用户一直卡在那儿等待或者一直转圈圈,体验非常不好.为了改善这种体验,我赶紧上网搜索,果然,前人早已有解决办法了.那就 ...

  4. 用docsify快速构建文档,并用GitHub Pages展示

    什么是docsify 无需构建,写完 markdown 直接发布成文档,写说明文档的极佳选择. 快速上手 安装 npm i docsify-cli -g docsify init docs 创建项目 ...

  5. Redis之数据类型大全

    一:String类型 1.set方法:设置key对应的值为string类型的value,如果该key已经存在,则覆盖key对应的value值.所以在redis中key只能有一个. 127.0.0.1: ...

  6. 设置pdsh的默认登录模式

    1.check your pdsh default rcmd rsh pdsh -q -w localhostSee what your pdsh default rcmd is. 2.Modify ...

  7. 动态权限<三>华为小米特殊机制

    动态权限对于谷歌来说从android6.0引入,对于国内的rom来说,这个题目不是好的选择题.因为大多数时候由于使用群众的层次不同,有些人在乎隐私的泄露,而更多的人却并不关心,使用了动态权限,增加了用 ...

  8. 统计学习方法c++实现之七 提升方法--AdaBoost

    提升方法--AdaBoost 前言 AdaBoost是最经典的提升方法,所谓的提升方法就是一系列弱分类器(分类效果只比随机预测好一点)经过组合提升最后的预测效果.而AdaBoost提升方法是在每次训练 ...

  9. keyup在移动端失效解决方法

    keyup在移动端失效解决方法: $("#OBJ").on("input propertychange", function(){ }); 采用 input 与 ...

  10. Xiuno BBS 4.0 修改时间显示

    修罗开源轻论坛程序 - Xiuno BBS 4.0Xiuno BBS 4.0 是一款轻论坛产品,前端基于 BootStrap 4.0.JQuery 3,后端基于 PHP/7 MySQL XCache/ ...