第一個監聽程式並輸出監聽內容

首先簡述下在myeclipse 下建立 監聽程式的小過程在 src 下建立個listener 檔案夾,然後在此檔案夾下 new  -> class 然後在點 add  輸入 servletContextlistener 確定就OK 了最後 修改 web.xml 就完成 了 jsp 頁面內容<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

ZOJ 1005 Jugs

題意:兩個罐子倒水題解:#include<cstdio>#include<algorithm>#include<cstring>using namespace std;int a, b, n;bool vis[1010][1010], flag;int res[10100], step;void print(){ for(int i = 0; i < step; i++) { switch(res[i]) {

ZOJ 1006 Do the Untwist 加密解密 類比

題意:加密、解密題解:#include<cstdio>#include<algorithm>#include<cstring>using namespace std;int key;int c2i[1000];char i2c[1000];void init(){ for(int i = 'a'; i <= 'z'; i++) c2i[i] = i - 'a' + 1; c2i['_'] = 0; c2i['.'] = 2

劃分樹模板

#include<cstdio>#include<cmath>#include<cstring>#include<algorithm>using namespace std;#define MAXN 100001#define L(u) (u<<1)#define R(u) (u<<1|1)#define MID(l, r) ((l+r)>>1)struct SegTree{ int l, r;}

HDU 3974 Assign the task 線段樹(樹映射到區間)

題意....題解:#include<cstdio>#include<cmath>#include<cstring>#include<algorithm>using namespace std;#define MAXN 100001#define L(u) (u<<1)#define R(u) (u<<1|1)struct A_NODE{ A_NODE *sun, *bro; int num;}

Filter 過濾程式 過濾非法ip地址

登入介面login_form.jsp<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><

HDU 4288 Coder 離線線段樹部分更新

題意:下標模5等於3的數的和。題解:可以這樣,線段樹的每個節點存一個數組 sum[5],表示當前節點覆蓋的區間中,從左到有編號,模 5 為 0,1,2,3,4的所有數的和每個節點再儲存一個當前節點所包含的區間中有多少個數的資訊:cnt。那麼:        添加的時候就是在相應的位置把整數加進去,並把 cnt+1        刪除的時候就是在相應的位置賦值為 0,並把 cnt-1關於 pushUp 的問題,我們可以這樣考慮:        父親的 cnt 肯定是兩個兒子的 cnt 的和   

HDU 4291 A Short problem 矩陣,多重函數求迴圈節

題意: According to a research, VIM users tend to have shorter fingers, compared with Emacs users.  Hence they prefer problems short, too. Here is a short one:  Given n (1 <= n <= 1018), You should solve for g(g(g(n))) mod 109 + 7  whereg(n) = 3g(

HDU 1412 搬寢室 DP

題意:。。。題解:將所有的數從小到大排序。證明一個性質:若一個數num[i]被選中,那麼一定要選num[i-1]或者num[i+1]來與它配對,這樣才能使差方最小。例如有下面四個數,他們從小到大到分別為x, x+a, x+a+b, x+a+b+c選擇(x,x+a),(x+a+b,x+a+b+c) ,差方=a^2+c^2選擇 (x,x+a+b),

POJ 2983 Is The Information Reliable

這題也是很明顯的差分約束,找負環 對於條件a,b,c,a-b=c轉化成a-b>=c&&a-b<=c,條件a,b,約束為a-b>=1 添加超級源點V0,到所有點的權值為0,如果發現負環,則情報不可信 用Bellman-Ford,加不加最佳化差距很明顯,不加最佳化就TLE,加了後只要600MS左右 代碼:#include<iostream>using namespace std;const int MAX=1005;const int inf=1<

POJ 1904 King’s Quest

不錯的題目,看了別人的解體報告才會,膜拜大牛!http://hi.baidu.com/saintlleo/blog/item/ab5e6b1b65f538c5a7866906.html 把男女分為左右兩個集合,如果男a喜歡女b,a向b連一條邊,對於題目給的完美匹配,女b向男a連一條邊 然後求強連通分量,如果一個男的和某些女的在一個強連通分量中,他們可以結婚,注意,女的要在男人喜歡的名單中找,可能有一些男女在同一個連通分量中,但是男的不喜歡女的 如果某些男女在一個強連通分量中

hdu 1061 Rightmost Digit

要求n^n的最右邊一位,由觀察可知,這一位的結果只與n的個位上的數字有關結果為((n%10)^n)%10,線性暴力求解逾時了,用二進位加速 代碼:#include<iostream>#include<cstdio>using namespace std;int pow(int p,int n){int a=p,ret=1;while(n){if(n&1)ret=ret*a%10;a=a*a%10;n>>=1;}return ret;}int main(

POJ 3592 Instantaneous Transference

對於別人來說很水的題,對我來說很難。。。唉 首先,這道題抽象成一張有向圖,由於magic power的存在,使得這張圖中存在環,於是想到用強連通分量縮點的方法,把這張圖變成DAG圖(有向非循環圖),把每個分量中各個點的權值累加(注意可能為0) 然後從左上方的點所在的分量開始,求一條最長的一條帶權路徑,有很多方法,網上說的有拓撲排序,Bellman-Ford(運用記憶化搜尋),DFS等等,由於資料量小,我就用了拍起來比較簡單的DFS 這道題又被讀題給害了, in the order from

POJ 2480 Longge’s Problem

求1~n中每個數與n的最大公約數的和我的方法,先因式分解n,然後dfs求出n的所有約數,與n的最大公約數一定是n的某個因數,我們只要知道對每個d|n,gcd(i,n)=d,1<=i<=n,有幾個i滿足,即1~n中與n的最大公約數為d的數位個數就好了,而這個個數正好是PHI(n/d),PHI為歐拉函數 網上看到別人一個利用積性函數解決的http://scturtle.is-programmer.com/posts/19388.html在數論中的積性函數:對於正整數n的一個函數 f(n)

ZOJ 3687 The Review Plan I 容斥原理/禁位排列

題意:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4970題解:#include<cstdio>#include<cstring>#include<algorithm>using namespace std;#define MOD 55566677#define lint long long#define MAXN 52int fa[MAXN];int n, m;int a[MAXN][

POJ 1330 Nearest Common Ancestors 最近公用祖先模板/線上/離線

題意:求樹上兩個節點的最近公用祖先演算法一:tarjanLCA(u) {  Make-Set(u)  ancestor[Find-Set(u)]=u  //設定u所在集合的祖先  對於u的每一個孩子v {   LCA(v)   Union(v,u)              //把v產生的子集併入u中   ancestor[Find-Set(u)]=u //防止採用樹形啟發學習法合并使u的集合根(代表)變化  }  checked[u]=true  對於每個(u,v)屬於P {   if

HDU 3966 Aragorn’s Story 樹鏈剖分模板

題目:http://acm.hdu.edu.cn/showproblem.php?pid=3966題解:#include<cstring>#include<cstdio>#include<algorithm>#include<vector>using namespace std;#define MAXN 50010#define L(u) (u<<1)#define R(u) (u<<1|1)//寫在類裡面爆棧int n,

CodeForces Round#35解題報告

這次的輸入輸出居然要用IO流,搞得我一開始提交了幾次不成功,出錯問題也看不懂。。。看了首頁的comment才發現問題 A 水題,每次交換兩個位置的值(1表示有球,0表示沒球),最後輸出值為1的位置 代碼:#include<iostream>#include<algorithm>using namespace std;int a[4];int main(){int i,j,k,ball,count;freopen("input.txt", "rt", stdin);

POJ 2060 Taxi Cab Schedule

與POJ 3216類似,不過這道題兩站之間的距離是曼哈頓距離,不要Floyd求最短距離  代碼:#include<iostream>using namespace std;struct node{int start;int end;int a,b,c,d;}ride[500];int m,g[505][505];int link[505],u[505];int dfs(int t){for(int i=1;i<=m;i++){if(g[t][i]&&!u[i])

POJ 3177/3522 雙連通分量

兩個題一樣的意思,而且3177的資料很少,拿3522的去交,不用改大小都過了。。。 題目意思是要讓無向圖任意兩點間至少有兩條路徑可達,先求出邊雙連通分量,求橋,把橋刪除後縮點求度,度為1的點(葉子)個數為x,x!=1(一個雙連通分量),答案為0,否則答案為(x+1)/2 代碼:#include<iostream>using namespace std;const int MAX=5001;struct node{int v,op,next,vis;}g[MAX*6];int dfn[

總頁數: 61357 1 .... 13164 13165 13166 13167 13168 .... 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.