UVA 465

#include<stdio.h>#include<stdlib.h>#define MAX_INT 2147483647char num1[300],num2[300];int main(){ char c; while (scanf("%s %c %s", num1, &c, num2)==3) { printf("%s %c %s\n", num1, c, num2); double a, b;

HDU 1281 棋盤遊戲(最大二分匹配)

還是一樣,熟悉模板!然後就是先這個樣的題目,同一行活同一列只能有一個子的題目,可以用二分匹配來做,也就是每一行只能陪一列,不能重複!這道題,也是一個一個點試出來的,看看有沒有等價邊!代碼:#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int const N = 110;int n, m, k, g[N][N];int cx[N], cy[N];bool

HDU 2087 剪花布條(字串匹配KMP)

這道題,也是字串匹配的問題,資料不大,估計暴力也可以,用時間要求是1000MS,KMP演算法15MS過的!給力!然後唯一不同的是,在模式串中不算有重疊的匹配串,只算一共有多少個不重疊的就好。要想最多,那很好辦,只要從頭挨著剪,就不會破壞其他的,比如aaaa,aa只要是從剪,就能剪出兩個,要是從中間開始,只能剪出一個。因此……見代碼:#include <cstdio>#include <cstring>const int N = 1010;char str[N], s[N]

UVa 10092 The Problem With the Problem Setter ( SAP )

這道TLE了,用的是最初的網路流演算法,具體叫什麼演算法我就記不清了,但是像這樣的資料,是逾時了這道題主要是SAP求最大流資料不大,矩陣可以解決,後面的文章會寫關於SAP的知識的學習筆記裡面,會詳細說一下SAP演算法,這裡就直接說一下這道題這道題建圖不難,就是源點和題目, 容量1, 題目和目錄,容量1, 目錄和匯點,容量是目錄所包含的題目數代碼如下:(這也是一道模板題)#include <cstdio>#include <cstring>#include

UVA 216

#include <stdio.h>#include <string.h>#include <math.h>#define MAX 200int n;int p[MAX], ans[MAX], used[MAX]; float x[MAX], y[MAX], min;float cal( float x1, float y1, float x2, float y2 ){return sqrt( pow(x1-x2, 2) + pow(y1-y2, 2) ) +

hdoj 4551 生日猜猜猜

題目連結//hdoj 4551//2013-05-26-20.52#include <stdio.h>int day[2][13] = {{0,31,28,31,30,31,30,31,31,30,31,30,31},{0,31,29,31,30,31,30,31,31,30,31,30,31}};int judge(int y){ if (y%4 == 0 && y % 100 != 0 || y % 400 == 0) return 1;

可惡的runtime error

最近做uva的string類題目老是出現runtime error 哪錯了都不知道。一下是常見的原因可是我發現我程式貌似沒有一下問題還是error,9命啊ACCESS_VIOLATION 您的程式想從一些非法的地址空間讀取或向其中寫入內容。一般例如指標、數組下標越界都會造成這個錯誤的。ARRAY_BOUNDS_EXCEEDED 您的程式試圖訪問一個超出硬體支援範圍的數組單元。 FLOAT_DENORMAL_OPERAND

uva445 – Marvelous Mazes

Your mission, if you decide to accept it, is to create a maze drawing program. A maze will consist of the alphabetic charactersA-Z, * (asterisk), and spaces. Input and OutputYour program will get the information for the mazes from the input file.

uva 10057 – A mid-summer night’s dream.

Problem CA mid-summer night’s dreamInput:standard inputOutput:standard output This is year 2200AD. Science has progressed a lot in two hundred years. Two hundred years is mentioned here because this problem is being sent back to 2000AD with the help

POJ 3683 Priest John’s Busiest Day(2-SAT + 拓撲輸出方案)

【題目連結】http://poj.org/problem?id=3683【題目大意】有個小鎮上有n對夫妻要舉辦婚禮,每隊夫妻都要請鎮上的牧師舉行一個儀式,但是鎮上只有一個牧師,牧師一次只能為一對夫妻做儀式。已知每隊夫妻的婚禮的起始t1和結束的時間t2,

poj 2481 Cows(樹狀數組 | 線段樹)

連結:http://poj.org/problem?id=2481題目大意:給n個區間,對於兩個區間【Si,Ei】和【Sj, Ej】,如果Si <= Sj 且Ej <= Ei 且Ei - Si > Ej - Sj, 就說區間i比區間j“強大”。也就是區間i要嚴格包含區間j。求每個區間i,有多少個區間比i“強大”,並輸出。分析與總結:昨天的CF的B題Big

poj 2528 Mayor’s posters(線段樹,離散化,成段更新染色)

連結:http://poj.org/problem?id=2528題目大意:在長度為10000000的牆上貼海報,海報的高度和牆的高度一樣,不同的海報覆蓋在不同的地區。如果有重疊位置,則後面貼的海報會把之前貼的海報覆蓋掉。問最終有幾張海報可以看到?分析與總結:又一道成段更新的線段樹染色問題來嘍。1. 用map來離散化,結果TLE了。。。然後改用數組存,用二分查詢位置,63MS過了,看來以後都不要再用map了。2.

poj 1976 A Mini Locomotive (dp 二維01背包)

題目連結:http://poj.org/problem?id=1976題目大意:某個車站有N個火車車廂,編號為1~N,每個車廂上有xi個人。這個車站還有三個火車頭,他們能拉最多m個車廂(m<=N/3),而且這m個車廂的編號要連續的。問這三個火車頭最多能拉多少個人。思路:因為m<=N/3, 所以按照貪心的思想,為了拉更多的人,每個火車頭一定是要拉m個連續的車廂。然後,為了求某段連續的車廂共有多少人,可以首碼和預先處理, 某一段和=sum[ i ] - sum[ i-m].f[i][j]

UVa 10827 – Maximum sum on a torus

題目連結:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=1768原題:A grid that wraps both horizontally and vertically is called a torus. Given a torus where each cell contains an

HDU 2544 最短路(各種最短路演算法的實現)

連結:http://acm.hdu.edu.cn/showproblem.php?pid=2544題目:Problem

HDU 4628 Pieces(狀態壓縮dp)

點擊開啟連結題目大意:給一個字串,每次可以刪除一個可不連續迴文子串,問最少刪幾次可以全部刪完。思路:因為字串長度最大16,所以可用二進位狀態表示, 1表示選取這個字元,0不選,組成一個子串。先預先處理出所有狀態,看這個狀態是不是迴文。f[i]表示狀態i最少幾次可以全刪完, 初始化f數組INFf[i] = min{f[i], f[s]+1 } s是i的子集。 #include<iostream>#include<cstdio>#include<cstring>#

UVa 108 – Maximum Sum

連結:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=44原題:BackgroundA problem that is simple to solve in one dimension is often much more difficult to solve in more than one

HDU 2473 Junk-Mail Filter 【並查集+設立虛父節點(馬甲)】

題目連結:http://acm.hdu.edu.cn/showproblem.php?pid=2473原題:Problem DescriptionRecognizing junk mails is a tough task. The method used here consists of two steps:1) Extract the common characteristics from the incoming email.2) Use a filter matching the

【設計模式】學習筆記4:簡單原廠模式(Simple Factory)

本文出自   http://blog.csdn.net/shuangde800之前已經學過“針對介面編程,而不是針對實現編程”,但是,當使用“new”時,卻的確是在執行個體化一個具體類,所以用的是具體實現,而不是介面。Duck duck = new MallardDuck( );上面就是常用的執行個體化的new 方法。用"new"有什麼不好呢? 在技術上,new

HDU 1142 A Walk Through the Forest

連結:http://acm.hdu.edu.cn/showproblem.php?pid=1142題目:A Walk Through the ForestTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3689    Accepted Submission(s): 1340Problem DescriptionJimmy

總頁數: 61357 1 .... 10222 10223 10224 10225 10226 .... 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.