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. 【转载】COM 组件设计与应用(十二)——错误与异常处理

    原文:http://vckbase.com/index.php/wv/1238.html 一.前言 程序设计中,错误处理必不可少,而且通常要占用很大的篇幅.本回书着落在 COM 中的错误(异常)的处理 ...

  2. 【BZOJ1048】 [HAOI2007]分割矩阵

    [BZOJ1048][HAOI2007]分割矩阵 题面 bzoj 洛谷 题解 \(dp[a][b][c][d][num]\)表示将矩形\((a,b,c,d)\)分成\(num\)个的最小方差,然后转移 ...

  3. sprinboot之mongodb

    一.MongoDB是一个基于分布式文件存储的数据库.由C++语言编写.旨在为WEB应用提供可扩展的高性能数据存储解决方案. MongoDB是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当 ...

  4. 手把手带你打造一个 Android 热修复框架(上篇)

    本文来自网易云社区 作者:王晨彦 前言 热修复和插件化是目前 Android 领域很火热的两门技术,也是 Android 开发工程师必备的技能. 目前比较流行的热修复方案有微信的 Tinker,手淘的 ...

  5. 按键精灵手机版多点找色,图片对比 by <剑行洪荒> 忠哥

    代码: Do    Dim ret1,ret2    Delay 500    ret1 = CmpColor(76,72, "153274", 0.9)    ret2 = Cm ...

  6. Core - Provide an easy way to store administrator and user model differences in a custom store (e.g., in a database)

    https://www.devexpress.com/Support/Center/Question/Details/S32444/core-provide-an-easy-way-to-store- ...

  7. AndroidStudio下使用 RecyclerView xml文件不显示预览条目并报错类似:NoClassDefFoundError 问题解决

    在项目中使用RecyclerView是很普遍的,最近工作中遇到了这种情况: RecyclerView可以正常使用 不会报错 但是在layout中的xml文件中不显示并且报错,如下图:(报的错忘了截了, ...

  8. 【转】Linux系统下的ssh使用

    Linux系统下的ssh使用(依据个人经验总结)   对于linux运维工作者而言,使用ssh远程远程服务器是再熟悉不过的了!对于ssh的一些严格设置也关系到服务器的安全维护,今天在此,就本人工作中使 ...

  9. 解决java读取大文件内存溢出问题

    1. 传统方式:在内存中读取文件内容 读取文件行的标准方式是在内存中读取,Guava 和Apache Commons IO都提供了如下所示快速读取文件行的方法: Files.readLines(new ...

  10. GlusterFS分布式存储集群-1. 部署

    参考文档: Quick Start Guide:http://gluster.readthedocs.io/en/latest/Quick-Start-Guide/Quickstart/ Instal ...