输出小于输入值的所有正偶数。 1、while语句 #include <stdio.h> int main(void) { int i = 2, j; puts("please input an integer."); printf("j = "); scanf("%d", &j); while ( ...
分类:
编程语言 时间:
2021-04-20 15:40:50
阅读次数:
0
/** 硬币找零:三个硬币面值2,5,7,希望用最少的硬币数拼出27* 分析:用动态规划解* f[X]:最少的硬币拼出X,设最后一步用a拼出了27,a可以是2/5/7,那么* f[27]=f[27-a]+1,因为不知道a具体是多少,所以,f[27]=min{f[27-2]+1,f[27-5]+1,f ...
分类:
其他好文 时间:
2021-04-16 12:02:09
阅读次数:
0
[]byte 和 string 的区别 这两个都经常用于初始化字符串,而且经常互相转换,很疑惑 []byte 究竟是什么 声明的方式有2种:[]byte("hello world") 或者 []byte{97,98} 注意这里是ASCII码其实等价于 []byte("ab") 打印看看: packa ...
分类:
其他好文 时间:
2021-04-16 11:52:53
阅读次数:
0
众所周知 对于基本类型而言,equals和==没有区别,但对于引用类型 equals比较的是内容(类型+值),==比较的是地址 一开始我以为像Integer这种包装类由于是引用类型,应该用equals比较 直到... Integer a=20; Integer b=20; System.out.pr ...
分类:
其他好文 时间:
2021-04-15 12:17:29
阅读次数:
0
package com.example.query; import java.io.Serializable; public class UserQuery implements Serializable { private Integer id; private String username; ...
Description: A peak element is an element that is strictly greater than its neighbors. Given an integer array nums, find a peak element, and return it ...
分类:
其他好文 时间:
2021-04-13 11:52:46
阅读次数:
0
约瑟夫环 题目: 剑指 Offer 62. 圆圈中最后剩下的数字 5727. 找出游戏的获胜者 1、数学解法就是通过倒推,求出队伍长度为n时,(n=1)的下标会变成什么。 class Solution { public int lastRemaining(int n, int m) { int an ...
分类:
其他好文 时间:
2021-04-12 12:42:41
阅读次数:
0
原题链接 题解:注意建立边 代码: #include <iostream> #include <algorithm> #include <cstring> #include <cmath> using namespace std; const int N = 5e3 + 9; const int M ...
分类:
其他好文 时间:
2021-04-12 12:34:29
阅读次数:
0
Delphi function 函数的返回值,也就是Result,建议直接在函数开始就做一些初始化 例如下面的代码 procedure TForm1.FormCreate(Sender: TObject); var i:Integer; str:string; begin Memo1.Lines.C ...
source program: list=[]while True: print("how many number input:") try: num=int(input()) for i in range(num): a=int(input("input"+str((i+1))+"integer: ...
分类:
编程语言 时间:
2021-04-12 11:41:22
阅读次数:
0