zoj 1450 (http://blog.himdd.com/?p=2666) 很多隻是可以做模板,直線相交求交點,三角形外接圓圓心(外心)

題意:給你n個點,求一個最小的圓把所有點覆蓋了。分析:最小圓覆蓋。神奇的隨機演算法。當點以隨機的順序加入時期望複雜度是線性。algorithm:A、令Ci表示為前i個點的最小覆蓋圓。當加入新點pi時如果pi不在Ci-1裡那麼pi必定在Ci的邊界上。B、再從新考慮這樣一個問題,Ci為前i個點最小覆蓋圓且p在Ci的的邊界上!同理加入新點pi時如果pi不在Ci-1裡那麼pi必定在Ci的邊界上。這時我們就包含了兩個點在這個最小圓的邊界上。C、再從新考慮這樣一個問題,Ci為前i個點最小覆蓋圓且有兩個確定點

HDOJ2028 Lowest Common Multiple Plus 求n個數的最小公倍數

這道題整整提交了8次才AC。Post Code:#include<iostream>using namespace std;__int64 gcd(__int64 x,__int64 y){//用輾轉相除法求2個數的最大公約數 int r; if(x<y){ r=x; x=y; y=r; } while(r!=0){ r=x%y; x=y;

Poj 3259(bellman_ford)

WormholesTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 25394 Accepted: 9083DescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that

UVa Problem 10132 File Fragmentation (檔案片段)

// File Fragmentation (檔案片段)// PC/UVa IDs: 110306/10132, Popularity: C, Success rate: average Level: 2// Verdict: Accepted// Submission Date: 2011-05-19// UVa Run Time: 0.012s//// 著作權(C)2011,邱秋。metaphysis # yeah dot net#include

Hdu–2544–最短路

最短路Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 21906    Accepted Submission(s): 9323Problem

HDU-1166-敵兵布陣(樹狀數組)

HDU-1166-敵兵布陣(樹狀數組)http://acm.hdu.edu.cn/showproblem.php?pid=1166這題之前用線段樹做的,現在用樹狀數組先簡單說下樹狀數組吧如所示c1 = a1c2 = a1 + a2c3 = a3c4 = a1 + a2 + a3 + a4c5 = a5c6 = a5 + a6c7 = a7c8 = a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8對於序列a,我們設一個數組C定義C[i] = a[i – 2^k + 1]

HDU-1028-Ignatius and the Princess III

HDU-1028-Ignatius and the Princess IIIhttp://acm.hdu.edu.cn/showproblem.php?pid=1028整數劃分,無奈,逾時#include<stdio.h>int huafen(int n,int m)//將n分為最大加數不超過m{if(n<1||m<1)return 0;if(n==1||m==1)return 1;if(n<m)return huafen(n,n);if(n==m)return

HDU-1298-T9

HDU-1298-T9http://acm.hdu.edu.cn/showproblem.php?pid=1298很好的一題,字典樹+DFS,思路參考swm8023大牛的題意是類比手機IME,給出幾個單詞即頻度,再給出幾個數字串,確定對於給定的一個數字串,每輸入一個數字,將顯示什麼字元本題的數字串的每一個數字均代表一個字母,而不是平常的手機,多個數字可能代表一個字母,首先可將給出的單詞即頻度記錄到字典樹中,對於數字串進行DFS,尋找其可能表示的頻度最大的字串例如    ab  2       

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

【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

【POJ3009 – Curling】 解題報告+思路+代碼+教訓(看別人的報告過的)

#include <cstring>#include <cstdlib>#include <cstdio>#include <iostream>#define INPUT/**Problem : poj3009看別人的報告過得,代碼基本上相同,因為實在不會了Begin Time: 11th/3/2012 7:28 p.m.End Time: 11th/3/2012 11:10

CF 179(div2)D(floyed)

D. Greg and Graphtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGreg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them

poj 3050 搜尋

HopscotchTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1462 Accepted: 1043DescriptionThe cows play the child's game of hopscotch in a non-traditional way. Instead of a linear set of numbered boxes into which to hop, the cows create a 5x5

UVa 10905 – Children’s Game

/* 就是一些數字字串 ,怎樣排序讓組成的數字最大 貪心: 每次選兩個字串組成的數大的放在前面就行了 */ #include<stdio.h>#include<string.h>#include<iostream>using namespace std;//int str[55][1000];struct node{ char str[128]; // int len;}ss[57];bool cmp(node a,node b){

10048 – Audiophobia\\Floyd

  Problem B: Audiophobia Consider yourself lucky! Consider yourself lucky to be still breathing and having fun participating in this contest. But we apprehend that many of your descendants may not have this luxury. For, as you know, we are the

10054 – The Necklace//歐拉迴路

/*判斷有無歐拉迴路 還是老樣子: 先判斷圖是否連通,這道題是無向圖,然後判斷每個點的度,最後列印之*/#include<cstdio>#include<cstring>using namespace std;const int maxn = 1005;int G[maxn][maxn];int degree[maxn];int f[maxn];int n;int find(int x){ if(x != f[x]) { f[x] =

組合數學學習之錯位排列(持續更新)

全錯位排列有三種解法,嘿嘿,那我就要一探究竟!一、遞推        假設排列是1,2,3,4···n個數,Dn表示n個數的全錯位排列的方法數。D1 = 0、D2 = 1        那麼對於第1個位置,假設由k去占。現在就有兩種情況:       1)、1和k互換了位置,k佔1的位置,1佔k的位置:那麼此時相當於1和k位置確定,只需要討論Dn-2的排列數。       2)、1沒有佔k的位置,而是佔了其它的位置:那麼此時相當於只確定了k的位置,需要討論Dn-1的排列數。       但是有(

UVa 160 Factors ans Factorials(數論)

自從換了linux,就沒寫過題解。今天開始要繼續寫。首先,求一個數的階層裡面每個素數因子的個數,那麼我們就可以求從2開始到這個數的每個數的素數因子的個數,相應加和。比如是10!= 1*2*3*4*5*6*7*8*9*10, 那麼 這裡面2的個數就是2,4, 6, 8,

題目1528:最長迴文子串

/*Mancher主演算法。學習地址:http://blog.csdn.net/ggggiqnypgjg/article/details/6645824功能:求出以i為中心的迴文半徑p[i];參數:傳入構造好的字串長度特殊說明:因為前面加了一個無效字元,所以下標從1開始。*/#include <stdio.h>#include <string.h>#define N 200000+10char sb[N];char str[2*N];int dp[2*N];int

UVa Problem 10142 Australian Voting (澳大利亞投票)

// Australian Voting (澳大利亞投票)// PC/UVa IDs: 110108/10142, Popularity: B, Success rate: low Level: 1// Verdict: Accepted// Submission Date: 2011-05-22// UVa Run Time: 0.844s//// 著作權(C)2011,邱秋。metaphysis # yeah dot net#include <iostream>#include

總頁數: 61357 1 .... 9334 9335 9336 9337 9338 .... 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.