原创 lightoj 1006

題意:根據題上給出的代碼,求出輸出。 思路:題上給的數據大,用記憶化。 AC代碼: #include <iostream> #include <algorithm> #include <cstring> #include <cs

原创 Lightoj 1002

題意: 求s點到其他點的路徑上的最小的最大值。(說起來有點繞口) 思路: 自己sb的上去寫個floyd(TLE)。就是個最短路的變形題。 dist[i]保存s到點i的路徑上的最小的最大值。 AC代碼: #include <i

原创 uva1151

題意: 思路: 算法入門經典358. AC代碼: 不懂這個二進制優化。 #include <cstdio> #include <cmath> #include <vector> #include <cstring> #incl

原创 poj1556 && nyoj227

題目鏈接poj1556 && nyoj227 題意:從(0,5)點到(10,5)點的最近距離。 思路:可以轉化成從起點到終點的最短路,這題放了好幾天了,一直想不到怎麼建圖,今天終於想出來了。 考察線段相交。 AC代碼: #in

原创 Lightoj 1007

題意: 求a到b之間的歐拉函數的平方的和。 思路:歐拉函數打表。 #define ll unsigned long long 要用 unsigned long long AC代碼: #include <iost

原创 Lightoj 1004

題意:求走過路的最大和。 思路:dp AC代碼: #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <map

原创 開始學習計算幾何啦

先預習了計算幾何的基本知識,今天就要正式開始學習計算幾何了。 先刷了道水題。 nyoj78 圈水池 一看就是個凸包,上網搜了凸包的資料,算是看懂了(不過寫題就不會了)。 AC代碼: #include <bits/stdc++.h

原创 poj1066 && nyoj83

題目鏈接 poj1066 & nyoj83 題意:從外面到達寶藏所走的最少的門。 思路:枚舉邊上的點。 AC代碼: #include <cstdio> #include <cstring> #include <algorith

原创 poj2826

題目 題意:兩條直線組成一個圖形,能裝多少雨水。 思路:如果可以,就會圍成一個三角形。兩條邊的最高點 中 低點的y座標爲圍成的三角形的上邊的y座標,再求出交點座標,求面積。(不看討論區真做不出來)。 AC代碼: #inclu

原创 Lightoj 1010

題意: 求能放的最多的馬的數量。 思路: 數學題,分情況討論。 AC代碼: #include <algorithm> #include <iostream> #include <cstring> #include <cstdio

原创 幾道凸包題

poj1113 Wall 題意: 略。 思路:求凸包。 AC代碼: #include <cstdio> #include <cstring> #include <algorithm> #include <iostream

原创 Lightoj 1003

題意: 判斷是否有環。 思路:看別人都是用拓撲排序寫的,自己太菜還沒有學會拓撲排序,我是用並查集AC的。 AC代碼: #include <iostream> #include <cstdio> #include <cstrin

原创 uva10048

題意:。 思路:入門經典365。 AC代碼: #include <stdio.h> #include <string.h> #include <algorithm> #include <iostream> #include <

原创 Lightoj 1009

題意: 兩方戰爭,求可能最大的一方軍隊人數。 思路: 看了一下別人的代碼,是用二分圖染色寫的。 AC代碼: //Lightoj 1009 #include <algorithm> #include <iostream> #inc

原创 Lightoj 1008

題意: 給一個無限大的矩陣往裏面放數字。 思路: 略。 AC代碼: #include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #i