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 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
就是输入t个数,对于每个数n,输出n*n个数。
i为1-n,j为1-n,输出i*j。
每一行最后一个输出后面没有空格啊!!!
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t =sc.nextInt();
while(t-->0){
int n =sc.nextInt();
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(j==1){
System.out.print(i*j);
}else{
System.out.print(" "+i*j);
}
}
System.out.println();
}
}
}
}
HDOJ(HDU) 2123 An easy problem(简单题...)的更多相关文章
- 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 ...
- HDU 2123 An easy problem
http://acm.hdu.edu.cn/showproblem.php?pid=2123 Problem Description In this problem you need to make ...
- HDOJ(HDU).1016 Prime Ring Problem (DFS)
HDOJ(HDU).1016 Prime Ring Problem (DFS) [从零开始DFS(3)] 从零开始DFS HDOJ.1342 Lotto [从零开始DFS(0)] - DFS思想与框架 ...
- HDOJ/HDU 2537 8球胜负(水题.简单的判断)
Problem Description 8球是一种台球竞赛的规则.台面上有7个红球.7个黄球以及一个黑球,当然还有一个白球.对于本题,我们使用如下的简化规则:红.黄两名选手轮流用白球击打各自颜色的球, ...
- HDU 5475:An easy problem 这题也能用线段树做???
An easy problem Time Limit: 8000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) ...
- HDU 5475 An easy problem 线段树
An easy problem Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pi ...
- hdu 5475 An easy problem(暴力 || 线段树区间单点更新)
http://acm.hdu.edu.cn/showproblem.php?pid=5475 An easy problem Time Limit: 8000/5000 MS (Java/Others ...
- 数据结构(主席树):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 ...
- HDOJ(HDU) 2139 Calculate the formula(水题,又一个用JavaAC不了的题目)
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) 看到这个时间,我懵逼了... 果然,J ...
随机推荐
- LINQ高级编程 笔记
相关资料:http://www.cnblogs.com/lifepoem/archive/2011/12/16/2288017.html 1.什么是LINQ 语言集成查询是一系列标准查询操作符的集合, ...
- SQL SERVER 中PatIndex的用法个人理解
一般用法:PatIndex('%AAA%',‘BBBBBBBB’) 上句的意思是查找AAA在BBBBBBBB中的位置,从1开始计算,如果没有的话则返回0 其中%AAA%的用法和 SQL语句中like的 ...
- framework not found -fno-arc编译错误
由于我是刚接手的代码 然后我拿来运行根本就是运行不了的 然后需要在linker 那边删除点东西就可以了. 把下边的两个删除就可以了 关于other linker flags 的介绍 请参考http ...
- JavaScript 保留关键字
JavaScript 保留关键字 在 JavaScript 中,一些标识符是保留关键字,不能用作变量名或函数名. JavaScript 标准 所有的现代浏览器完全支持 ECMAScript 3(ES3 ...
- Idea中运行Testng时,报SAXParseException:parallel为none的问题原因及解决
今天更新了testng的版本为6.9.10, 在idea中运行测试案例时,报错如下: org.testng.TestNGException: org.xml.sax.SAXParseException ...
- PHP~foreach遍历名单数组~有必要多次观看练习
- SQL服务器名称的更改
SQL服务器名称的更改 1.使用select @@ServerName可以看到当前数据库的服务器名称 2.从Sys.SysServers表中可以看到当前的所有服务器名称 3.使用 sp_drops ...
- 解决IE6不支持position:fixed;的问题
在网页设计中,时常要用到把某个元素始终定位在屏幕上,即使滚动浏览器窗口也不会发生变化. 一般我们会使用position:fixed来进行绝对固定,但IE6并不支持position:fixed属性,所以 ...
- linux根目录下各文件的作用
各文件详列: /bin 存放常用命令的目录(二进制可执行命令) /dev 设备特殊文件 /etc 存放配置相关的文件(系统管理和配置文件) /etc/rc.d 启动的配置文件和脚 ...
- 简单的贴图显示shander
Shader "ztq/Diffuse" { Properties { _Color ("Main Color", Color) = ...