码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
java每日小算法(5)
/*【程序5】 题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示。 1.程序分析:(a>b)?a:b这是条件运算符的基本例子。*/ packagetest; publicclasstest{ publicstaticStringgrade(intnum){ Stringresult=(num..
分类:编程语言   时间:2014-05-27 03:54:17    阅读次数:247
【C++基础】关键字static 局部变量
1.局部变量static局部变量和普通局部变量有什么区别:static局部变量只被初始化一次,下一次依据上一次结果值;int test(int j){static int i=10;i=i+j;return i;}int main(void){ ////美图秀秀笔试 int m=test(12);....
分类:编程语言   时间:2014-05-23 09:17:44    阅读次数:354
DAG 模型
1.#include#include#define MAXN 1010int n, G[MAXN][MAXN];int x[MAXN], y[MAXN], d[MAXN];int dp(int i) { int& ans = d[i]; if(ans > 0) return ans; ans ...
分类:其他好文   时间:2014-05-23 08:49:48    阅读次数:211
Asakura的魔法世界
代码如下: #include #include double dis(double x1, double y1, double x2, double y2) {     return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2)); } double v1, v2, v3, x[4], y[4];...
分类:其他好文   时间:2014-05-22 12:09:29    阅读次数:247
编程之美之格格取数
#include//??????????С???? ? С???? #include using namespace std; int lfh(int n) { return (n*(n+1)/2)*(n*(n+1)/2); } unsigned int js(int n) { unsigned int ms=0; unsigned int sum=0; uns...
分类:其他好文   时间:2014-05-22 12:08:06    阅读次数:245
LeetCode: Search in Rotated Sorted Array [032]
【题目】 Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target value to search. If found in the array return its index, otherwise return -1. You may assume no du...
分类:其他好文   时间:2014-05-22 10:43:12    阅读次数:310
最长上升子序列之基础
代码a #include #define maxn 1005 int a[maxn]; int dp[maxn]; int max(int x,int y) {     return x>y?x:y; } int main() {     int t,n;            scanf("%d",&t);...
分类:其他好文   时间:2014-05-22 09:16:47    阅读次数:192
2014华为实习上级笔试题——三天打鱼两天晒网
#include using namespace std; int func(int year)//判断闰年的个数 {     int count=0;     for(int i=1990;i         if(year%4==0&&year%100!=0||year%400==0)             count++;         return cou...
分类:其他好文   时间:2014-05-22 06:34:15    阅读次数:252
Doxygen资料整理
@author作者@brief摘要@version版本号@date日期@file文件名,可以默认为空,DoxyGen会自己加@class类名@param函数参数@return函数返回值描述@exception函数抛异常描述@warning函数使用中需要注意的地方@remarks备注@seeseealso字段@notebrief下空一行后的内容表示详细描述,但..
分类:其他好文   时间:2014-05-20 22:38:54    阅读次数:319
博弈树,动态规划(计算好的子问题存储起来,以后直接取用)
public class GameTree { /** * 判断剩余球数,谁能取到最后谁赢, * ,一人取一次,默认我方先取,,能否必胜,能就返回true,否则false * @param x剩余球数 * @return */ static boolean f(int x){ int[] op={1,3,7,8};//每次取球只能有四种情况 for(int i=0;i if (...
分类:其他好文   时间:2014-05-20 14:09:29    阅读次数:263
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!