- 博客(15)
- 收藏
- 关注
原创 Matlab 字符串时间戳转化为数值(以秒或毫秒为单位)
在Java中,将字符串类型的日期,如“2022-02-09 23:59:55”转化为long类型(以毫秒为单位),可以用以下代码实现:long timeValue = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") .parse(string_date) .getTime();System.out.println(timeValue);输出结果为1644422395000。在Matlab中,也可以实现类似的方法,如下:time_t
2022-02-12 23:58:16
8033
原创 【ANTLR4】使用ANTLR4生成Java类的两种方式
1. 使用IDEA的界面这种情况再网上的资源里非常多,有详细的图文介绍,比如https://blog.youkuaiyun.com/poised/article/details/51420478中提到的,链接里还提到了使用命令的方法。使用IDEA处理的时候,遇到一个问题:当生成访问器的时候,总是会出现 Override is not allowed in implementing interfac...
2019-08-19 16:24:19
3334
原创 Linux Time Command
在linux机器上,time命令可以记录程序运行时间。在控制台直接输入 time <command>, 会输出三个值,real, user, sys. 关于这三个值的含义在很多博客中都有说明。在后台运行time 命令,输出是user, system, elapsed. 单位也和之前的不一样。GNU VERSION Below a description ...
2019-04-24 09:25:01
863
原创 Write and Read Parquet File in Java, Query with Filter and Specify Projections
Links for more informationwhat is parquet: http://parquet.apache.orgAPI to use: https://www.javadoc.io/doc/org.apache.parquet/parquet-column/1.10.0maven dependencies<dependency> <...
2019-02-17 14:49:42
867
原创 Write and Read TsFile in java
Write and read TsFile in javaWhat is TsFileTsFile is a kind of file format which supports for columnar database storage.Click link http://iotdb.incubator.apache.org/#/ for more information.ma...
2019-02-17 13:56:14
463
原创 String vs StringBuilder vs StringBuffer (Java)
What's the difference among String, StringBuilder and StringBuffer, in Java?LabsLab 1 Append Method public static void app(String s){ s += " world"; } public static void ap...
2019-02-10 22:35:23
265
原创 幂运算 C++(快速幂和大数运算)
1. 快速幂提高运算速度。传统幂时间复杂度为O(n),使用快速幂缩小为O(logn),其中n为指数。基本思想:base*=base 这里就是在算int poww(int a, int b){ // return a ^ b int ans = 1, base = a; while(b != 0){ if(b&1 != 0) ans *= base; ...
2018-06-07 22:07:00
13581
1
原创 Java实现表达式计算(中缀表达式转化为后缀表达式/逆波兰式)
定义:中缀表达式:我们平时写的数学表达式一般为中缀表达式,如“”,直接拿中缀表达式直接让计算机计算表达式的结果并不能做到。后缀表达式:把中缀表达表达式“”转化“”这样的形式,就是后缀表达式。这种记法叫做后缀(postfix)或逆波兰(reverse Polish)记法。计算这个问题最容易的方法就是使用一个栈。转换方法:按次序读取中缀表达式的字符。读到一个操作数的时候,立即放入到输出中。读到操作符“...
2018-03-18 13:23:44
21989
9
原创 Java解决排列组合问题——深度优先遍历
问题1: 假设袋子里有编号为1,2,...,m这m个球。现在每次从袋子中取一个球几下编号,放回袋中再取,取n次作为一组,枚举所有可能的情况。分析:每一次取都有m种可能的情况,因此一共有种情况。这里我们取m = 3, n = 4,则有种不同的情况。代码:import java.util.Stack;public class Test { static int cnt = 0; s...
2018-03-15 23:05:37
6376
2
原创 Linux下python2.7出现No module named _struct问题
问题描述:1. $ sudo apt upgrade之后出现问题 You might want to run 'apt-get -f install' to correct these.2. $ sudo apt-get -f install之后出现问题ImportError: No module named _struct3. 用python导入struct$ sudo python>...
2018-02-25 11:21:32
8752
1
原创 uva-11809
Problem backgroundFloating-point numbers are represented differently in computers than integers. That is why a 32-bit floating-point number can represent values in the magnitude of while a 32-bit in...
2018-02-18 21:15:51
375
原创 uva-1588
Problem BackgroundA research laboratory of a world-leading automobile company has received an order to create a special transmission mechanism, which allows for incredibly efficient kickdown — an oper...
2018-02-18 12:42:08
525
原创 uva-1587
Problem backgroundIvan works at a factory that produces heavy machinery. He has a simple job | he knocks up wooden boxes of different sizes to pack machinery for delivery to the customers. Each box is...
2018-02-17 16:04:57
433
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人