POJ-2352-Stars

POJ-2352-Starshttp://poj.org/problem?id=2352給出n個星星的座標,如果一個星星的左下方(包含正左和正下)有k顆星星,就說這顆星星是k級的,統計每個等級有多少個點。這題可用樹狀數組,對於每個星星按y座標從小到大排序,相同y座標按x座標從小到大排序(題目中資料已經有序),輸入順序已排好序,那麼只要依次統計星星i之前x座標小於等於i.x的星星有多少,即是星星i的層級#include<stdio.h>#include<string.h>#

HDU-2102-A計劃

HDU-2102-A計劃http://acm.hdu.edu.cn/showproblem.php?pid=2102今天要到學校的第一天,天氣還是挺熱的,我的暑假也算是結束了,在家的一個月裡,看了一部電視劇《浮沉》,挺喜歡白百合的,也深刻體會了白領階級的辛酸;還有就是把《閃客2》這個號稱是橫板鬼泣的遊戲玩通關了,自己還是鐘情於單機遊戲,不多說了這題是BFS,注意處理#即可#include<iostream>#include<cstdio>#include<cstri

HDU-2717-Catch That Cow

HDU-2717-Catch That Cowhttp://acm.hdu.edu.cn/showproblem.php?pid=2717基本的BFS,朝3個方向搜尋即可#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<queue>using namespace std;int n,k;char

POJ-1087-A Plug for UNIX

POJ-1087-A Plug for UNIXhttp://poj.org/problem?id=1087n1個插座,n2個電器及其對應的插座,n3個轉化器,前一個插座可以轉化為後一個插座,問最少有多少裝置沒有插座用,轉換器數量不限最大流,源點向插座建邊,容量為1,電器向匯點建邊,容量為1,相應的插座和電器連邊,容量為1,前一個插座轉化為後一個插座,後一個插座向前一個插座建邊,容量為無窮大,求得的最大流即為最多配對的電器#include <iostream>#include

HDU-1548-A strange lift

HDU-1548-A strange lifthttp://acm.hdu.edu.cn/showproblem.php?pid=1548基本的BFS,上下兩個方向搜尋#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<queue>using namespace std;int n;int visit[205];int num[205]

POJ-3040-Asteroids

POJ-3040-Asteroidshttp://poj.org/problem?id=3041X表示一個敵人,給出所有敵人的座標,炸彈可以炸掉該炸彈所在一行或者所在的一列,求最少需要多少個炸彈才能炸掉所有的敵人對於每一個敵人,炸彈要麼在該敵人所在的行,要麼在該敵人所在的列,將敵人的所在行當作X集合,敵人所在列當作Y集合,每個敵人的X和Y連一條邊,那麼題目就轉為求最小點覆蓋,最小點覆蓋等於最大匹配#include<cstdio>#include<cstring>#incl

AOJ-579-期末考試之考試傳紙條

AOJ-579-期末考試之考試傳紙http://icpc.ahu.edu.cn/OJ/Problem.aspx?id=579BFS,按模版寫的,比賽時資料輸入處理弄錯了,哎。。。太弱了。。。#include<stdio.h>#include<string.h>#include<stdlib.h>int n,m;char map[105][105];int ans[105][105];int dir[4][2]={{-1,0},{1,0},{0,-1},{0,1

POJ-2226-Muddy Fields

POJ-2226-Muddy Fieldshttp://poj.org/problem?id=2226建圖很巧妙,一塊木板能覆蓋一行或一列的土地,先按行來鋪木塊,再按列來鋪木塊*.*.   按行1  0  2  0    按列 1  0  4  0.***           0  3  3  3             0  3  4  5***.           4  4  4  0             2  3  4  0..*.            0   0  5  0  

HDU-2195-Going Home

HDU-2195-Going

【POJ2255】Tree Recovery解題報告 思路 + 資料 +代碼

#include <cstdlib>#include <cstdio>#include <iostream>#include <cstring>using namespace std;/* Author: YuXun Lu Time:23rd/2/2012 Last Time:About 7 Hours Begin Time:Unknown End Time:Unknown Test Data:

POJ-3686-TheWindy’s

POJ-3686-TheWindy'shttp://poj.org/problem?id=3686最大權值匹配,建圖不好想,假設某個機器處理了k個玩具,時間分別為a1,a2…..,ak那麼該機器耗費的時間為a1+a1+a2+a1+a2+a3.......a1+a2+...ak   即a1*k + a2 * (k - 1) + a3 * (k - 2).... +

HDU-1258-Sum It Up

HDU-1258-Sum It Uphttp://acm.hdu.edu.cn/showproblem.php?pid=1258注意每個數只能用一次,且不能出現重複的等式#include<stdio.h>#include<string.h>#include<stdlib.h>int a[20],ans[20];int sum,n,flag;void dfs(int x,int count,int m){int

【poj3349】SnowFlake snow SnowFlake 解題報告+代碼

#include <iostream>#include <cstring>#include <cstdlib>#include <cstdio>////#define INPUT////#define DBG/** Begin Time:5:00 p.m. 1st/3/2012 End Time: 8:02 p.m. 1st/3/2012 Cost Time: 3Hours 2Mins 測試資料: 沒有……

POJ-2516-Minimum Cost

POJ-2516-Minimum Costhttp://poj.org/problem?id=2516N個顧客,M個供應商,K種貨物,給出一些供求關係,求滿求條件的最小代價最小費用最大流,對k種貨物的每一種求一次最小費用,相加即可#include<stdio.h>#include<string.h>#include<math.h>#define maxn 300#define INF 0x7fffffffint min(int x,int y){return

【ZOJ1649 Rescue】 解題報告+代碼+思路

#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>//#define INPUTusing namespace std;/** Problem : ZOJ1649 - Rescue Begin Time : 7:00 p.m. 17th/Mar/2012 End Time : 22:17 17th/Mar/2012

【Grids2418】Hardwood Species解題報告+代碼

#include<cstring>#include<cstdio>#include<cstdlib>#include<iostream>//#define INPUT/** Problem: Grids2418 - Hardwood Species Begin Time: 7:30 p.m. 29th/2/2012 End Time: 2012-02-29 21:35:04 Cost Time: 2Hours 5Mins

【poj3253】堆的應用

#include <iostream>#include <stdio.h>#include <algorithm>#include <stdlib.h>#define INPUTusing namespace std;const int MAXSIZE = 50010;bool comp1(int a,int b){ return a>b;}int main(){#ifdef INPUT

HDU-1278-逃離迷宮

HDU-1278-逃離迷宮http://acm.hdu.edu.cn/showproblem.php?pid=1728不好想,參考別的代碼寫的,題目要求轉彎的次數不能超過k,BFS,從一個方向搜到底#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<queue>using namespace std;int n1,n2,k;char

【ACM模板】HASH表(無刪除功能,添查)

#include <iostream>#include <cstring>#include <cstdio>#include <cstdlib>#include <algorithm>#include <time.h>using namespace std;const int HASH_SIZE = 1000000;const int HASH_KEY = 17;int

HDU-1253-勝利大逃亡

HDU-1253-勝利大逃亡http://acm.hdu.edu.cn/showproblem.php?pid=1253簡單的三維BFS#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<queue>#include<cmath>using namespace std;char visit[52][52][52];char

總頁數: 61357 1 .... 13474 13475 13476 13477 13478 .... 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.