hdu 1166 線段樹

/* hdu 1166 跟1754是一樣的 線段樹*/#include <cstdio>#include <cstring>#define maxn 50005using namespace std;struct Node{ int l,r,sum;}node[maxn*3];int T;int n;void build(int x,int y, int i){ node[i].l=x; node[i].r=y;

MFC毛玻璃

//貝神傑作,僅作記錄,以後學習#define GDIPVER 0x0110 //定義高版本的GDI+(1.1)#include <tchar.h>#include <windows.h>#include <ObjIdl.h>#include <stdio.h>#include <GdiPlus.h>#pragma comment(lib,"GdiPlus.lib")using namespace Gdiplus;#include

poj 2533 最長上升子序列 DAG

/* poj 2533 將每個數看做DAG圖上的一個節點 d[i]代表到i點的最長路徑 求所有d[i]中最大的那個 i點的前j個中,如果num[j]<num[i],即j到i點有向*/#include <cstdio>#include <cstring>#include <algorithm>using namespace std;#define maxn 1004int nums[maxn];int d[maxn];int

hdu 1176 DP

/* hdu 1176 DP 狀態轉移方程 d[i][j]=max(d[i+1][j],d[i+1][j-1],d[i+1][j+1]); 本來想用一維數組存的 ,但發現這樣做的話會導致使用到新更新的資料, 比如在第i秒,j-1的位置剛被更新,j要比較前一個狀態下三個位置哪個大 但是j-1位置已經是第i秒的了*/#include <cstdio>#include <algorithm>#include

CodeForces 131C 組合數學

/* CodeForces 131C 組合數學*/#include <cstdio>#include <cmath>using namespace std;__int64 cal(__int64 a, __int64 b){ __int64 tem=1; for(int j=1;j<=b; j++) { tem=tem*a/j; a--; } // printf("%d\n",tem);

hdu 2182 DP

/* hdu 2182 DP還是不熟練, dp[i][j]表示第i跳時,第j個座標點能吃到蟲子的最大值*/#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#define maxn 105using namespace std;int ins[maxn];int dp[maxn][maxn];int T;int ans;int n,a,b,

hdoj_2553N皇后問題

N皇后問題Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4933    Accepted Submission(s): 2252Problem

poj 3070 二分法+矩陣乘法

/* poj 3070 二分冪+矩陣乘法 要注意代碼的簡潔 把功能塊單獨寫個函數*/#include <cstdio>#include<cmath>#define mod 10000using namespace std;__int64 n;__int64 c[2][2];//__int64 f[maxn]={0,1};__int64 cal(__int64 a[][2],__int64 b[][2]){ __int64 sum;

hdu 2795 線段樹

/* hdu 2795 線段樹 在更新環出了問題 導致被修改子節點的父節點沒有更新 (最後導致逾時) 這裡我用了位元運算 但是沒有變快。。。反而慢了10ms; 教訓:發現有錯誤之後 測試構造的線段樹有沒有錯,再查線段樹是否在更新的時候更新不完全*/#include <cstdio>using namespace std;#define maxn 200006int h,w,n;int ans;int flag;struct Node{

二叉樹先序遍曆、中序遍曆、後序遍曆

輸入二叉樹的先序遍曆序列和中序遍曆序列,輸出該二叉樹的後序遍曆序列。(非建二叉樹版本)#include<iostream>#include<string>using namespace std;string preord, inord;void rebuild (int preleft, int preright, int inleft, int inright){int root, leftsize, rightsize;if(preleft <=

poj_2488A Knight’s Journey

A Knight's JourneyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 22481 Accepted: 7598DescriptionBackground The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around the

資料結構之二叉樹的建立與遍曆

已知一個按先序序列輸入的字元序列,如abc,,de,g,,f,,,(其中逗號表示空節點)。請建立二叉樹並按中序和後序方式遍曆二叉樹,最後求出葉子節點個數和二叉樹深度。#include<iostream>#include<queue>#include <cstdlib>#include <cstdio>using namespace std;typedef struct BiNode{char data;struct BiNode

double x = 12.5; printf(“%d\n”,x);

#include <stdio.h>int main(){double x = 12.5;printf("%d\n",x);int y = 10;printf("%lf\n",y);}輸出:00.000000float x = 12.5;printf("%d\n", x);float: 1位符號位(s)、8位指數(e),23位尾數(m,共32位)double:

利用SetConsoleTextAttribute函數設定控制台顏色

控制台單調的顏色只有黑白兩種,看起來多少難免有些單調。在沒學圖形化編程之前,每天看著控制台程式難免會枯燥無味。不過,利用SetConsoleTextAttribute函數可以設定控制台的前景色彩和背景色。閑言少敘,書歸正傳。①:(顏色可以混合,遵循配色原理)#include <windows.h>#include <iostream>using namespace std;int main(){ HANDLE hOut; hOut =

opencv調用網路攝影機

#include <cstdio>#include <highgui.h>int main(){IplImage *pImg = NULL;CvCapture *cap = cvCaptureFromCAM(0);char fileName[100];char key;int count = 0;while(1){pImg = cvQueryFrame(cap);cvFlip(pImg, NULL, 1);

hdu 1114 背包問題

/* hdu 1114 題目大概意思是把錢存在一個存錢罐裡面 給出空存錢罐的重量和裝錢後存錢罐的重量, 給出幾種貨幣的價值和重量,問你在不超過重量的情況下,貨幣價值的最小值 實際上就是一個背包問題,類似那個硬幣問題 用dp[i]表示需要湊足重量i需要的最少貨幣價值 在DAG圖上可以表示為確定起點DP[s]和終點dp[0],求最短路徑 dp[0]為0; */#include <cstdio>#include

開源3D遊戲引擎Irrlicht(鬼火)用法入門

開源3D遊戲引擎Irrlicht(鬼火)用法入門 趙剛  Irrlicht(中文名:鬼火)是著名的3D開源引擎之一,該3D引擎結構清晰,執行效率高,上手容易,無論是初學者學習3D遊戲引擎,還是用來開發規模較小的3D應用都是很不錯的選擇。 本文以Irrlicht 1.7.2 版(目前的最新版)為例,講解其在Windows系統中的用法。 首先需要在http://irrlicht.sourceforge.net/downloads.html 下載Irrlicht的SDK,1.7.2版的SDK尺寸為24

HDU 1009 FatMouse’ Trade

貪心類題目算出javabean的價值再排序/* 需要注意ja為0或者f為0的情況 */#include <iostream>#include <cstdio>#include <algorithm>#define INF 99999999#define maxn 1005using namespace std;struct Node{ double ja,f,price;}node[maxn];bool cmp(Node a,Node

hdu 1128 Self Numbers

/* hdu 1128 只要把不符合的都標記起來,再輸出沒有標記的就可以了 之前犯了個小錯誤 WA了*/#include <cstdio>#define maxn 1000000using namespace std;bool hash[maxn];int main(){ int sum; for(int i=1;i<=maxn;i++) { sum=i; int j=i;

hdu 1496 改良版

/*這種線性探測再散列技術處理衝突的方法節省了空間,也縮短了時間*/#include<stdio.h>#include<memory.h>#define MAX 50021int f[MAX],g[MAX];int hash(int k){ int t=k%MAX; if(t<0) t+=MAX; while(f[t]!=0&&g[t]!=k) t=(t+1)%MAX; return t;}int

總頁數: 61357 1 .... 21726 21727 21728 21729 21730 .... 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.