Scanner java.util包提供的一个类 使用前导入该包
char ch = 'k';
System.out.println("请输入单个字符");
try {
ch = (char) System.in.read();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(ch);
Scanner scanner = new Scanner(System.in);
System.out.println("输入单个字符");
char ch = scanner.next().charAt(0);
System.out.println(ch);
输入多个字符 ctrl+p不知道数据类型的时候看下
read 默认返回类型是int
public class IOput {
public static void main(String[] args) throws IOException {
System.out.println("请输入一行字符串");
byte[] bytes = new byte[1001];
int n = System.in.read(bytes);
for (int i = 0; i < n; i++) {
System.out.println((char) bytes[i]);
}
}
}
7.1建党节被我说成了建军节。。。怪不得我没有思想觉悟呢
Sql的题目真的要常刷常新啊 还是要制定学习计划
连续的id题目 都是用id-rk
Leetcode601.体育馆的人流量(困难)
机智套路方法- 大数据处理下的方法
with t1 as(
SELECT *,rank() over(order by id ),id-rank() over(order by id ) as rk from stadium
where people>=100
)
SELECT id,visit_date,people from t1
where rk in(select rk from t1
GROUP BY rk
having count(rk)>=3)
呆瓜方法
SELECT DISTINCT s1.* from stadium s1,stadium s2,stadium s3
where s1.people>100 and s2.people>100 and s3.people>100
and (
S1.id +1 = S2.id AND S1.id+2=S3.id OR
S1.id +1 = S2.id AND S1.id-1=S3.id OR
S1.id -1 = S2.id AND S1.id-2=S3.id
)
order by s1.id
Leetcode_608. 树节点
case when 语句中间没有逗号
SELECT *,
case
when p_id is null then 'ROOT'
when id in (SELECT DISTINCT p_id FROM tree) then 'Inner'
else 'Leaf' end as type
from tree
java 相关
二维数组定义:int array[][] = new int[3][3];
获取行数: int rowLength = array.length;
获取列数: int colLength = array[0].length;