zoj 1589 傳遞閉包

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=589 簡單閉包。。。注意一下用scanf來讀入字元時getchar()使用就ok了#include<stdio.h>#include<string.h>int re1[30][30],re2[30][30];int main(){//freopen("a.txt","r",stdin);int t;scanf("%d",&t);int

zoj 1905 字串

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1905很DT的說。。。沒有看到原來Input後是有“.”的!!!靠!#include<stdio.h>#include<string.h>char str[1000001];int main(){while(scanf("%s",str)!=EOF){if(str[0]=='.')break;int len=strlen(str);int

poj 1990【樹狀數組】

http://poj.org/problem?id=1990這題調試了n久!!!就是因為變數名有點亂,自己也亂了。#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>using namespace std;int num_small[20010],sum_small[20010];int Max;struct node{ int val,pos;}

hdu 2063 過山車 基礎最大二分匹配

http://acm.hdu.edu.cn/showproblem.php?pid=2063 忘了每次清空那幾個DT的數組導致wa。。。低級錯誤。。。囧 #include<stdio.h>#include<string>#define MAX 510bool path[MAX][MAX],visit[MAX];int match[MAX];bool searchpath(int s,int m){for(int i=1;i<=m;i++){if(path[s][i]

hdu 3015【樹狀數組】

http://acm.hdu.edu.cn/showproblem.php?pid=3015犯一些低級錯誤。。。例如忘了return,注意求大和求小的式子---【ans+=t[i].ch*(num_min*t[i].cx-sum_min +

【樹狀數組or歸併排序求逆序數】HDU 1394

http://acm.hdu.edu.cn/showproblem.php?pid=1394 先說一下逆序數的概念:在一個排列中,如果一對數的前後位置與大小順序相反,即前面的數大於後面的數,那末它們就稱為一個逆序。一個排列中逆序的總數就稱為這個排列的逆序數。逆序數為偶數的排列稱為偶排列;逆序數為奇數的排列稱為奇排列。如2431中,21,43,41,31是逆序,逆序數是4,為偶排列。                                    ——這是北大《高等代數》上的定義。題意是說給

poj 3622 Gourmet Grazers

 http://poj.org/problem?id=3622無限orz把STL用得淋漓盡致的大牛。。。本題用貪心,先對cow的新鮮度進行降序,再對grass的新鮮度進行降序,方便待會在grass中尋找符合grass[j].first>=cow[i].first的grass注意pair的排序是firs比second優先,unique返回唯一元素的最後那個地址,還要注意輸出要long

【樹狀DP】ural 1018

還有些不懂,先放下#include <vector>#include <list>#include <map>#include <set>#include <queue>#include <string.h>#include <deque>#include <stack>#include <algorithm>#include <iostream>#include

hust 1422【DFS】

http://acm.hust.edu.cn/thx/problem.php?id=1422STL+DFS#include<iostream>#include<cstdio>#include<string.h>#include<vector>#include<map>#include<cmath>#include<stack>#include<queue>#include<algorithm&g

【最長上升子序列O(nlgn)】HDU 1025

http://acm.hdu.edu.cn/showproblem.php?pid=1025利用貪心+二分去做,複雜度O(nlogn)#define N 500005int a[N],dp[N];//dp[len]表示長度為len的序列最後一個的最小值int main(){FRE; int n; int ca= 1; while(scanf("%d",&n)!=-1){ int i,j; for(i=0;i<n;i++){

【巧妙拓撲排序】poj 3687

這題網上大多建議反向topsort,不過也可以正向的,只是記錄的不是入度,而是出度!利用優先隊列每次取出label大的,下標從n往前記錄。注意:我代碼ans求出的只是1~n重量對應的標籤,題目中有For each test case output on a single line the balls' weights from label 1 to label N.所以還要轉化為重量從1~n所對應的標籤;還有,注意重邊!#include <vector>#include

poj 3259 Wormholes【Bellman-Ford Vs SPFA】

http://poj.org/problem?id=3259用Bellman-Ford和SPFA均可以判負環。。。SPFA【856KB  

【堆】poj 1441

#include <vector>#include <list>#include <map>#include <set>#include <queue>#include <string.h>#include <deque>#include <stack>#include <bitset>#include <algorithm>#include

hdu 2444 判斷是否構成二分圖,並求最大匹配

關於二分匹配詳見http://blog.csdn.net/leolin_/archive/2011/05/04/6393259.aspx**************************************************************http://acm.hdu.edu.cn/showproblem.php?pid=2444 //構造的二分圖雖然是多解的,但是任意一個二分圖的最大匹配數相等#include<iostream>using namespace

【基礎拓撲排序】poj 1094

這題很基礎也很經典,不過個人認為有一個非常容易出錯的地方,就是矛盾Inconsistency的優先順序比不確定的優先順序高,因為當前有矛盾就立即跳出,而當前有多個點入度為0就不能立即輸出,有可能後來加入的線段可以確定唯一答案,就像一樣。。。很陰險!wa了幾次才得以ac。原本想用隊列,但是不好搞#include <vector>#include <list>#include <map>#include <set>#include <queue&

zoj 2029【二分尋找】或【STL】

題目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1029題目大意是說給出a數組,對於b中的每一個在a中找出最小範圍使得ai<=b<a(i+1),注意Print a blank line after each test case.這一句話!開始沒看到結果WA了,杯具自敲的二分#include<iostream>using namespace std;#include<algorithm>

【基礎拓撲排序】poj 2376/ural 1022

簡單的topsort,不解釋!可用隊列做,也可用for遍曆!#include <vector>#include <list>#include <map>#include <set>#include <queue>#include <string.h>#include <deque>#include <stack>#include <bitset>#include

ural 1149【類比】

http://acm.timus.ru/problem.aspx?space=1&num=1149類比,不解釋。#include <vector>#include <list>#include <map>#include <set>#include <queue>#include <string.h>#include <deque>#include <stack>#include

SRM 505 —-score 250

文章目錄 紀念下第一道TC題。。。那格式實在很蛋疼,很不習慣Problem Statement Definition Constraints Examples  紀念下第一道TC題。。。那格式實在很蛋疼,很不習慣Problem Statement      You are given a simple paragraph containing a number of sentences, the original person who

hdu 1085 母函數—有限個

把它轉化為有限硬幣的模型只有3鐘情況,遍曆到sum就okhttp://acm.hdu.edu.cn/showproblem.php?pid=1085#include<stdio.h>#include<string>int c1[10000],c2[10000];int num[3]={1,2,5},m[3];int main(){int a,b,c;while(scanf("%d%d%d",&a,&b,&c) &&(a+b+c)){

總頁數: 61357 1 .... 13149 13150 13151 13152 13153 .... 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.