POJ 3273 Monthly Expense

//Time 297ms, Memory 640K#include<iostream>using namespace std;int n,m;int money[100010];int judge(int mid){int i,s=0,group=1;for(i=0;i<n;i++){if(s+money[i]<=mid)s+=money[i];else{s=money[i];group++;}if(group>m) return 0;}return 1;}int

POJ 1836 Alignment

題意: 令原隊列的最少士兵出列後,使得新隊列任意一個士兵都能看到左邊或者右邊的無窮遠處。就是使新隊列呈三角形分布就對了。要求最少出列數,就是留隊士兵人數最大,即左邊的遞增序列人數和右邊的遞減序列人數之和最大因而可轉化為求“最長降子序列”和“最長升子序列”問題。// Time 79ms; Memory 268K#include<iostream>using namespace std;int main(){int i,j,n,fl[1010]={0},fr[1010]={0},max=

歐幾裡得-GCD及擴充

GCD最大公約數int gcd(int x,int y){ if(!x || !y) return x>y?x:y; for(int t;t=x%y;x=y,y=t); return y;}快速GCDint kgcd(int a,int b){ if(a==0) return b; if(b==0) return a; if(!(a & 1) && !(b & 1)) return

POJ 1260 Pearls

題意:給出幾類珍珠,以及它們的單價,要求用最少的錢就可以買到相同數量的,相同(或更高)品質的珍珠。規定買任一類的珍珠n個(價格為p),都要支付(n+10)*p的錢,即額外支付10*p。(1)       要求要買的珍珠的數量是一定的(2)       所買的珍珠的品質允許提高,但不允許下降(即可以用高品質珍珠替代低品質)(3)       輸入時,後輸入的珍珠價格一定比前面輸入的要貴(4)       由(2)(3)知,珍珠的替代必須是連續的,不能跳躍替代。因為,假如方案是用第 i+2

hdu 1045 Fire Net-二分匹配

這題也可以用搜尋來做但用匹配做更簡單//Time 0ms,Memory 332K#include<iostream>#include<cstring>using namespace std;char city[4][5];int n,l1,l2,vis[10],flag[10],p[4][4],q[4][4],pq[10][10];int f(int u){ int i; for(i=0;i<l1;i++) if(!vis[i] &&

POJ 1459 Power Network

最大流-多源多匯問題建立超級源點,超級匯點#include<iostream>#include<cstring>#include<queue>#include<vector>using namespace std;const int inf=0xfffffff;queue<int>q;int n,np,nc,m,s,t;int cap[105][105],flow[105][105],d[105],g[105][105];int

hdu 1045 Fre Net

//Time 15ms,Memory 328K#include<iostream>#include<cstring>using namespace std;char city[4][5];int n,vis[16];int dfs(int i){ int c1,c2; for(;i<n*n;i++) if(!vis[i] && city[i/n][i%n]=='.') { int x=i/n,y=i%n;

hdu 1115 Lifting the Stone (求重心)

#include<iostream>#include<iomanip>using namespace std;typedef struct point{ double x,y; point(double x=0.0,double y=0.0):x(x),y(y){}}vector;point p[1000010],c;vector operator - (point a,point b) {return

POJ 1860 Currency Exchange

//Time 16ms, Memory 244K#include<iostream>#include<cstring>using namespace std;int cnt,n,m,s;double v;struct point{ int a,b; double r,c; point(int a=0,int b=0,double r=0.0,double c=0.0):a(a),b(b),r(r),c(c){}}p[201];int bellman(){

MyEclipse快速鍵收集

 MyEclipse快速鍵收集Ctrl+1 快速修複(最經典的快速鍵,就不用多說了) Ctrl+D: 刪除當前行 Ctrl+Alt+↓ 複製當前行到下一行(複製增加) Ctrl+Alt+↑ 複製當前行到上一行(複製增加) Alt+↓ 當前行和下面一行互動位置(特別實用,可以省去先剪下,再粘貼了) Alt+↑ 當前行和上面一行互動位置(同上) Alt+← 前一個編輯的頁面 Alt+→ 下一個編輯的頁面(當然是針對上面那條來說了) Alt+Enter 顯示當前選擇資源(工程,or 檔案

POJ 2253 Frogger

//Time 63ms, Memory 572K#include<iostream> #include<math.h> #include<iomanip> using namespace std; class coordinate { public: double x,y; }point[201]; double path[201][201]; //兩點間的權值 int main(void) { int

如何利用spring操縱對象

如何利用spring操縱一個對象呢。這是spring的最簡單的一個作用。我感覺一共有3步驟”第一:寫一個spring的xml。第二:執行個體化spring容器。第三:從xml裡面獲得具體的bean(也就是實際要操縱的對象) 首先引入jar就不說了。接著寫一個spring.XML<?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"      

POJ 1080 Human Gene Functions

題意:是求最長公用子序列的一個變型題;此題中的字元只有A,G,C,T四個,再加上'-';它們之間的不同匹配有對應的不同權值W;而且只有字元相同的匹配的權值為大於0;其他都為負值。此題就是求權值最大的匹配。f[i][j]: 表示第一個字串的前 i 個字元和第二個字串的前 j 個字元的最大權值。狀態方程:f[i][j]=max(f[i-1][j]+w[a[i]]['-'],f[i][j-1]+w['-'][b[j]],f[i-1][j-1]+w[a[i]][b[j]]);// Time 16ms;

filter中的url-pattern

 Servlet中的filter是J2EE開發中常用的技術,使用方便,配置簡單。servlet和filter中的url-pattern有一些文章在裡 面的,總結了一些東西,以免遇到問題又要浪費時間。   一,servlet容器對url的匹配過程:當一個請求發送到servlet容器的時候,容器先會將請求的url減去當前應用內容相關的路徑作為servlet的映射url,比如我訪問的是

POJ 1276 Cash Machine

動態規劃,多重背包題目大意:有各種不同面值的貨幣,每種面值的貨幣有不同的數量,請找出利用這些貨幣可以湊成的最接近且小於等於給定的數字cash的金額。// Time 79ms; Memory 640K#include<iostream>using namespace std;int v,f[100010];void zeroone_pack(int c) //01背包{for(int i=v;i>=c;i--) if(!f[i]){f[i]=f[i-c];}}void

POJ 2635 The Embarrassed Cryptographer

//Time 907ms, Memory 4480K#include<iostream>#include<string>using namespace std;int vis[1000010],prime[80000];int main(){int i,j,k=0,l,a[35],t;char s[105];memset(vis,0,sizeof(vis));memset(s,0,sizeof(s));for(i=2;i*i<1000010;i++)

博弈論入門小結

博弈論:是二人或多人在平等的對局中各自利用對方的策略變換自己的對抗策略,達到取勝目標的理論。博弈論是研究互動決策的理論。博弈可以分析自己與對手的利弊關係,從而確立自己在博弈中的優勢,因此有不少博弈理論,可以協助對弈者分析局勢,從而採取相應策略,最終達到取勝的目的。博弈論分類:(摘自百度百科)(一)巴什博奕(Bash Game):只有一堆n個物品,兩個人輪流從這堆物品中取物,規定每次至少取一個,最多取m個。最後取光者得勝。   

hdu 1077 Catching Fish

#include<stdio.h>#include<string.h>#include<algorithm>#include<iostream>#include<math.h>using namespace std;const int MAXN=330;const double eps=1e-4;double p[MAXN][2];double xx1,yy1,xx2,yy2;double dis(int i,int j){

POJ 1845 Sumdiv

// Time 16ms, Memory 328K#include<iostream> using namespace std; const int size=10000; const int mod=9901; __int64 sum(__int64 p,__int64 n); //遞迴二分求 (1 + p + p^2 + p^3 +...+ p^n)%mod __int64 power(__int64 p,__int64 n); //反覆平方法求 (p^n)

hdu 1099 Lottery

#include<stdio.h>__int64 gcd(__int64 a,__int64 b){ return b==0?a:gcd(b,a%b); }int main(){ int i,j,prime[]={2,3,5,7,11,13,17,19},n,t; __int64 s1,s2,m,d,gd; while(scanf("%d",&n)==1) { s2=1;s1=0;t=0; if(n==21 || n=

總頁數: 61357 1 .... 18263 18264 18265 18266 18267 .... 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.