计算两个时间点之间的分钟数 import datetime def minNums(startTime, endTime): '''计算两个时间点之间的分钟数''' # 处理格式,加上秒位 startTime1 = startTime + ':00' endTime1 = endTime + ':00' # 计算分钟数 startTime2 = datetime.datetime.strptime(startTime1, "%Y-%m-%d %H:%M:%S") endTime2 =…
题目链接:5198. 丑数 III 请你帮忙设计一个程序,用来找出第 n 个丑数. 丑数是可以被 a 或 b 或 c 整除的 正整数. 示例 1: 输入:n = 3, a = 2, b = 3, c = 5 输出:4 解释:丑数序列为 2, 3, 4, 5, 6, 8, 9, 10- 其中第 3 个是 4. 示例 2: 输入:n = 4, a = 2, b = 3, c = 4 输出:6 解释:丑数序列为 2, 3, 4, 6, 8, 9, 12- 其中第 4 个是 6. 示例 3: 输入:n…
题目 落单的数 III 给出2*n + 2个的数字,除其中两个数字之外其他每个数字均出现两次,找到这两个数字. 样例 给出 [1,2,2,3,4,4,5,3],返回 1和5 挑战 O(n)时间复杂度,O(1)的额外空间复杂度 解题 根据落单的数I,可以想到,所有的数进行异或运行的结果就是所求两个数的异或结果. 这个异或的结果,二进制数是1的位置说明这两个数对应的二进制位不相同.然后再怎么还原???参考,理解的不是很透,找到第k位后,再判断数组中所以数的第k位是0 还是1,,出现两次的数对求解无影…
setTimeout 方法用于在指定的毫秒数后调用函数或计算表达式…
A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to count the total strobogrammatic numbers that exist in the range of low <= num <= high. Example: Input: low = "50"…
/** *把1到100之间的数的偶数相加 */ class Demo{ public static void main(String[] args){ int i =1; int sum = 0; do{ if(i % 2 != 0){ sum += i; } //累加器需要在if语句外面 i++; }while(i <= 100); System.out.println(sum); } }…
class Demo12{ public static void main(String[] args){ /** * 打印1到100之间的数 * 循环条件:1~100 * * 计数器 * */ //定义一个变量作为计数器 int i = 1; do{ //第一次执行循环体时不需要判断 System.out.println(i); //计数器累加 i++; }while(i <= 100); } }…
* 产生10个随机数5-9之间 统计一个int类型的一维数组中有多少个在[min,max]之间的数 */ import java.util.*; public class Demo{ public static void main(String[] args) { int[] array=getRandom(3,9,-1); iterArray(array); } public static int[] getRandom(int min,int max,int count){ if(count…
Atitit 计算word ppt文档的页数 http://localhost:8888/ http://git.oschina.net/attilax/ati_wordutil private void ini() { word = new ActiveXComponent( "Word.Application"); word.setProperty("Visible", new Variant(false)); //不可见打开word //word.setPro…
Activity之间參数传递 A activity想将參数传给B activity时能够利用Intent将消息带过去 Intent intent = new Intent(this,BActivity.class); intent.putExtra("xxxx", "xxxx"); 数据量多的话能够使用 Bundle bundle = new Bundle(); intent.putExtras(bundle); 获取activity返回值 A activity调用…