@Id @GeneratedValue(strategy=GenerationType.IDENTITY) public int getId() { return id; } public void setId(int id) { this.id = id; }这段代码将ID设置成自动生...
分类:
其他好文 时间:
2014-08-03 12:37:05
阅读次数:
192
Least Common Multiplehttp://acm.hdu.edu.cn/showproblem.php?pid=1019 1 #include 2 int gcd(int a,int b){ 3 return b?gcd(b,a%b):a; 4 } 5 int lcm(int ...
分类:
其他好文 时间:
2014-08-03 12:27:35
阅读次数:
222
1)使用位运算,sum1=a^b 相当于不进位的加法,因为0+1=1.1+0=1.1+1=0(因为不进位)0+0=0 正好是或运算
2)sum2=(a&b)<<1,相当于算进位的数,因为只有1+1时进位
3)结果就是sum1+sum2,当然如果这个加法还需要进位就执行第四步
4)重复上面的过程一直到进位数(a&b)<<1为零,也就是不需要进位为止...
分类:
其他好文 时间:
2014-08-03 10:20:35
阅读次数:
205
# include
# include
# include
using namespace std;
int fa[10010];
struct node
{
int p;
int d;
};
struct node a[10010];
bool cmp(node a1,node a2)//利润从大到小
{
return a1.p>a2.p;
}
int find(int x)
{...
分类:
其他好文 时间:
2014-08-03 10:16:25
阅读次数:
208
法1:全部用定义float型法2:用int整型,答案用float型,注意此时 printf ("%.2f\n",d);中的d,确保是有小数的。比如0.00,才能运行。不过此法一些语言工具编译不过,一些oj也刷不过去。不过vc是合法的。内容: 已知上底、下底和高,求梯形的面积输入说明:一行三个数输出说...
分类:
其他好文 时间:
2014-08-03 10:11:04
阅读次数:
148
知识点:/ % 的灵活运用。内容: 一个三位自然数,分离出它的百位、十位与个位上的数字输入说明:一行一个三位整数输出说明:一行三个数字 , 空格隔开。分别是百 十 个位数字输入样例:256输出样例 :2 5 6#include int main(){ int a; scanf("%d",&a); p...
分类:
其他好文 时间:
2014-08-03 10:10:05
阅读次数:
195
题目:Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,....
分类:
编程语言 时间:
2014-08-03 10:09:25
阅读次数:
193
题目:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".click to show clarificatio....
分类:
编程语言 时间:
2014-08-03 10:07:05
阅读次数:
231
Corner cases!class Solution {public: ListNode *deleteDuplicates(ListNode *head) { if (!head) return head; if (!head->next) return hea...
分类:
其他好文 时间:
2014-08-03 07:51:34
阅读次数:
237
Nothing special. A typical list manipulation problem.class Solution {public: ListNode *partition(ListNode *head, int x) { if (!head) return ...
分类:
其他好文 时间:
2014-08-03 07:50:15
阅读次数:
214