hdu 1596 floyd演算法

//4000多MS過的,資料應該比較大,還是比較簡單的#include <iostream>#include <cstdio>using namespace std;const int maxn = 1001;int n;float G[maxn][maxn];float Dist[maxn][maxn];int Q;int from,to;int main(){ while(cin>>n) {

hdu 1062字串水題

#include <iostream>#include <string>#include <cstdio>using namespace std;int T;char str[1000];int begin,end;int main(){ while(scanf("%d",&T)!=EOF) { getchar(); for(int i = 1;i <= T; i++) {

hdu 1069 DP

做的很艱難,還參考了一下別人的。。。。。子問題是以每個矩形為底的塔的最大高度,所有子問題的解中最大的一個就是原問題的解,其中以某個矩形為底的塔的高度可以由自身高度加上可以放在其上的塔的最大高度得到#include <iostream>#include <algorithm>#include <cstring>using namespace std;int n;typedef struct{int xi;int yi;int zi;int base;

Emacs基本命令

今天早上花了半個小時學了一下Emacs,瞬間我就想拋棄vim了Emacs命令參考 C-v 查看下一屏文字 M-v 查看上一屏文字 C-l 重繪螢幕,並將游標所在行置於螢幕的中央  游標定位命令 C-p 上一行 C-n 下一行 C-f 下一個字元 C-b 上一個字元 M-f 下一個單詞 M-b 上一個單詞 C-a 定位到行首 C-e 定位到行尾 M-a 定位到句首 M-e 定位到句尾 M-< 移動到文章開頭 M-> 移動到文章結尾 M-{ 向前移動一段 M-} 向後移動一段 M-g

動態規劃1

動態規劃的有效性依賴於待求解問題本身具有兩個重要的性質:最優子結構性質和自問題重疊。(1)最優字結構性質,如果問題的最優解包含的自問題的解也是最優的,就稱該問題具有最優子結構性質(滿足最佳化原理),最優字結構性質為動態規划算法解決問題提供線索。(2)子問題重疊性質。子問題重疊性質是指在用遞迴演算法自頂向下對問題求解時,每次產生的子問題並不總是新問題,有些自問題會被重複計算多次。動態規劃正式利用了這種子問題的重疊性質,對每一個子問題只計算一次,然後將其計算結果儲存在一個表格中,當再次需要計算已經計

hdu 1071定積分

#include <iostream>#include <string.h>#include <cmath>#include <stdio.h>using namespace std;struct point{double x,y;};point p1,p2,p3;double a,h,l,k,b;double f (double x){return a*x*x*x/3 - (a*h + k/2)*x*x + (a*h*h+l-b)*x;}int

hdu 2037貪心

#include <iostream>#include <algorithm>using namespace std;struct ss{ int st; int ed;}node[110];//按電視節目結束時間排序 bool cmp(ss s1,ss s2){ return s1.ed < s2.ed || (s1.ed == s2.ed && s1.st < s2.st);}int main(){

SQL資料的分組與彙總

//資料的分組與彙總GROUP BY 用於根據前面的的參數集分組結果SELECT _StateFORM MemberDetailsGROUP BY _State;SELECT _StateFROM MemberDetailsWHERE _State IN ('Mega state','Golden State','new State')GROUP BY _State;//可以基於多列分組SELECT _StateFROM MemberDetailsWHERE _State IN ('Mega

poj 1251 kruskal

//這一題敲完直接AC,嚇尿了//kruskal做的,prim也行#include <iostream>#include <algorithm>#include <cstring>using namespace std;const int MAXN = 28;const int MAXM = 76;int T;struct edge{int u,v,w; }edges[MAXM];int Father[MAXN];int Rank[MAXN];int

SQL進階查詢的一些技巧

--進階查詢的一些技巧--1.使用AND時,盡量將很可能不為真的條件放在前面--2.使用OR運算子時,盡量將最可能為真的條件放在前面--3.DISTINCT比ORDER BY更快SELECT MemberIdFROM OrdersGROUP BY MemberId;--SELECT DISTINCT MemberIdFROM Orders; --4.限制聯合的結果,從資料庫中提取的資訊越少,速度越快--5.對子查詢使用IN運算子WHERE MemberId = (SELECT MemberId

線性快速劃分尋找第一個順序統計量

#include <stdio.h>#include <conio.h>int partition(int *R,int low,int high) //快速劃分{ int key; key=R[low]; while(low<high) { while(low<high&&R[high]>key) high--;

hdu1003最大子序列和

看了一些別人的題解,說實話,我現在還不會證明這個,我不知道為什麼這樣是最大值//hdu1003最大連續子序列和// sum[i] = sum[i-1]>0 ? sum[i-1]+a[i]:a[i];//只有當sum處於增長狀態時才會得到最大子序列//當sum處於減小狀態時,應當更新起點 #include <iostream>using namespace std;#define MAX 100003#define INF 0x7fffffff;int T;long N;int

如何在Fedora下播放mp3和多種格式視頻檔案

轉載自http://tiger506.blog.51cto.com/318536/367624使用一段時間Fedora後會想聽聽mp3,意外發現預設的播放器竟然無法播放,別急,這篇博文閱畢此題可解。1.先安裝RPM Fusion(RPM Fusion提供Fedora 或 Red Hat下不提供的軟體,是一個第三方軟體褲),一定要先安裝。安裝方法:2.安裝播放器 Audacious (在安裝完RPM

圖論-1 求連通分量

DFS架構:          vector<int>  G[maxn];     int vis[maxn];          void dfs(int u)     {          vis[u] = 1;          PREVISIT(u);          int d = G[u].size();          for(int  i = 0; i < d; i++)          {               int v = G[u][i]; 

圖論基礎-深度優先遍曆DFS

基本思想:訪問頂點v0,然後訪問v0鄰接的未訪問過的頂點v1,再從v1出發遞迴的按照深度優先的方式遍曆。當遇到一個所有鄰接於它的頂點都被訪問過的頂點u時,則回到頂點序列中最後一個擁有未被訪問過的相鄰節點的頂點W,從W繼續出發。最終當任何已被訪問過的節點都沒有未被訪問的節點時,遍曆結束。bool visited[maxn]={0};void DFS(int x){ visited[x]=true; printf("%d\n",x); int i;

sql基本語句整理

//sql基本語句整理//建立資料庫CREATE DATABASE database_name;//刪除資料庫DROP DATABASE database_name;//建立模式CREATE SCHEMA name_of_schema AUTHORIZATION name_of_user;//刪除模式DROP SCHEMA name_of_schema CASCADE;     //連級刪除,包括所有對象DROP SCHEMA name_of_schema RESTRICT;  

堆排序__演算法導論實現

這個排序是演算法導論上堆排序的實現,#include<iostream>#include<time.h>using namespace std;void max_heap(int data[],int i,int len)//對於左右子樹已是最大堆的樹,將整個樹產生最大堆{int left=2*i+1; int right=left+1;int

hdu 1232 並查集

#include <iostream>using namespace std;#define MAX 10001int N,M;int Father[MAX];int Rank[MAX];int sum;void Make_Set(int x){Father[x] = x;Rank[x] = 1;}int Find(int x){while(x != Father[x]){x = Father[x];}return x;}void Union(int x,int y){x =

poj 2031 Kruskal

//計算幾何+最小產生樹//注意精度//若兩單元園心距離小與半徑之和,則距離為0//反之,為距離-半徑之和#include <iostream>#include <algorithm>#include <cstdio>#include <cmath>using namespace std;const int MAXN = 101;const int MAXM = 500000;int n;int M;double cost;double eps =

hdu 1052貪心演算法

//貪心演算法//稍有點麻煩,要分析一下各種情況#include <iostream>#include <algorithm>using namespace std;int n;int Sp_A[1001];int Sp_B[1001];bool cmp(int x,int y){ return x > y;}int main(){ while(cin>>n) { if(n == 0)

總頁數: 61357 1 .... 24120 24121 24122 24123 24124 .... 61357 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.