上一页 1 2 3 4 5 6 7 ··· 12 下一页
摘要: #include #include int delX(int num[], int n, int x){ int i, j; i = 0; j = 0; for (i = 0; i < n; i++){ if (num[i] != x){ num[j] = num[i]; j++; } } return j;}print(int num[], int n){ int i; for (i = 0; i < n; i++){ printf("%d ", num[i]... 阅读全文
posted @ 2014-03-18 14:11 yutoulck 阅读(211) 评论(0) 推荐(0) 编辑
摘要: #include #include typedef struct Node{ int content; struct Node* next;}LNode;init(LNode** head){ *head = (LNode*)malloc(sizeof(LNode)); (*head)->content = 0; (*head)->next = NULL;}insert(LNode* head, int num){ LNode* newNode = (LNode*)malloc(sizeof(LNode)); newNode->content = nu... 阅读全文
posted @ 2014-03-18 12:42 yutoulck 阅读(596) 评论(0) 推荐(0) 编辑
摘要: package com.example.app;import android.os.HandlerThread;import android.os.Message;import android.support.v7.app.ActionBarActivity;import android.support.v7.app.ActionBar;import android.support.v4.app.Fragment;import android.os.Bundle;import android.util.Log;import android.view.LayoutInflater;import 阅读全文
posted @ 2014-03-18 00:08 yutoulck 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 直接上代码- -package com.example.viewholdtest;import android.content.Context;import android.support.v7.app.ActionBarActivity;import android.os.Bundle;import android.view.LayoutInflater;import android.view.Menu;import android.view.MenuItem;import android.view.View;import android.view.ViewGroup;import andr 阅读全文
posted @ 2014-03-17 21:55 yutoulck 阅读(498) 评论(0) 推荐(0) 编辑
摘要: 题目说明: 假設有一個背包的負重最多可達8公斤,而希望在背包中裝入負重範圍內可得之總價物品,假設是水果好了,水果的編號、單價與重量如下所示: 0 李子 4KG NT$4500 1 蘋果 5KG NT$5700 2 橘子 2KG NT$2250 3 草莓 1KG NT$1100 4 甜瓜 6KG NT$6700 首先,是每种水果都只有一个的算法。#include #include int getMax(int fruitP[], int fruitW[], int form[][9], int fruitNum, int bagW){ int i, j; for(i = 1; i ... 阅读全文
posted @ 2014-03-06 13:47 yutoulck 阅读(917) 评论(0) 推荐(0) 编辑
摘要: 特点是:子问题出现重叠;使用空间换取时间,因此一般需要一个表作为空间使用;用于最优化的处理,并且拥有最优子结构;无后效性;操作步骤:确定状态变量;确定决策以及状态转移方程;例子:http://blog.163.com/guixl_001/blog/static/41764104200863015855721/ http://www.cnblogs.com/yutoulck/p/3584375.html理解动态规划并不是很难,难的是自己从问题推断出需要应用动态规划并且懂得应用动态规划,状态变量以及状态转移方程的处理需要一定的思考。 阅读全文
posted @ 2014-03-06 10:40 yutoulck 阅读(200) 评论(0) 推荐(0) 编辑
摘要: #include #include int geZiQuShu(int num[][4], int h, int l){ int up, left; if(h left){ return up + num[h][l]; } else{ return left + num[h][l];; }}main(){ int num[4][4] = {20, 20, 20, 4, 5, 6, 20, 8, 9, 10, 20, 12, 13, 14, 20, 20}; int result; result = geZiQuShu... 阅读全文
posted @ 2014-03-06 10:29 yutoulck 阅读(173) 评论(0) 推荐(0) 编辑
摘要: #include #include int transform(char str[]){ int i = 0; int result = 0; while(str[i] != '\0'){ result = result * 10 + str[i] - '0'; i++; } return result;}main(){ char* str = "1234"; int result; result = transform(str); printf("%d \n", result);} 阅读全文
posted @ 2014-03-06 10:02 yutoulck 阅读(135) 评论(0) 推荐(0) 编辑
摘要: #include #include find(int num[][3], int h, int l, int x){ int i, j; int isFinded = 0; i = 0; j = l - 1; while(i = 0){ if(num[i][j] == x){ isFinded = 1; break; } else if(num[i][j] < x) i++; else j--; } if(isFinded == 1) printf("%... 阅读全文
posted @ 2014-03-06 09:58 yutoulck 阅读(180) 评论(0) 推荐(0) 编辑
摘要: #include #include JO(int num[], int n){ int i = 0; int j = n - 1; while(i < j){ for(; i < j; i++){ if(isO(num[i])) break; } for(; i < j; j--){ if(!isO(num[j])) break; } if(i < j){ swap(num, i, j); i++;j--; ... 阅读全文
posted @ 2014-03-03 11:03 yutoulck 阅读(171) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 12 下一页