SWUN 1425 – 瘋狂的馬兒

 瘋狂的馬兒 時間限制(普通/Java) : 1000 MS/ 3000 MS          運行記憶體限制 : 65536 KByte總提交 : 19            測試通過 : 5 描述 在一個5*5規模的棋盤上,放著黑馬和白馬。每種馬都有12個,因此棋盤上恰好有一個空格。在任意時刻,馬兒只允許移動到空格上(移動規則如所示) 現在,給定棋盤的初始狀態,Snow_storm想知道最少移動幾次可以達到如所示的目標狀態: 輸入     

POJ 3067 – Japan

 題目地址: http://poj.org/problem?id=3067 典型的樹狀數組題目。     跟小學時做的連線題很像,問共有多少個交點。兩點間只能用線段連,並且假設不會有3條及以上的線段交於同一點。    假設兩個點 (x1,y1)、(x2,y2)    假若 y2 > y1 ,那麼此時,只要存在 x1 < x2 ,那麼就一定存在交點。    即其中一點在另一點的左上方。    所以我們先對 y從大到小排序,若y相等則對x從大到小排序。   

POJ 3378 / UESTC 1460 – Crazy Thairs

 UESTC 地址 :   http://acm.uestc.edu.cn/problem.php?pid=1460POJ 地址 : http://poj.org/problem?id=3378        經典題目。       方法 :樹狀數組+dp+離散化+大整數      時間複雜度:O(5*n*2*logn)      因為資料太大,不能作為下標使用。      於是離散化。      然後利用DP的思想,樹狀數組的方法(五個樹狀數組),逐步把

POJ 3270 / HDU 2838 – Cow Sorting

 題目地址:  http://poj.org/problem?id=3270        注意到了其中一部分需要__int64,另一部分被想當然的忽略了(以為不可能爆int)。結果WA了n久不知原因。        很經典的求逆序數題目。初學題。比基本的逆序數多了一個狀態。即需要多寫一個Query。  #include<iostream>#include<cstdio>using namespace std;__int64 tree[100100];__int64

HDU 4339 – Query

 題目地址: http://acm.hdu.edu.cn/showproblem.php?pid=4339 12年多校 1009題。 方法: 樹狀數組+二分。 時間: O( n * logn * logn )  #include<cstdio>#include<iostream>#include<algorithm>using namespace std;char str[2][1001000];int tree[1001000],mx;void

POJ 2886 – Who Gets the Most Candies?

 題目地址: http://poj.org/problem?id=2886             一開始翻譯搓了。。。 囧。。。 F(p) is the number of positive integers that perfectly divide p.

win7搜尋功能失效/win7搜尋功能不能使用

前幾天更新了下系統,是用360更新的(也可能是中毒了)今天突然發現win7的開始菜單中的搜尋功能失效了,我的電腦裡面的搜尋功能也失效了,同時附加的現象還有開始菜單中的控制台點不開,原因到現在還沒找到。。。。不過總算在網上找到瞭解決方法。轉帖一下吧。解決方案:    1.win+r,輸入regedit,查看一下[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/Desktop/NameSpace],是否有下面

HDU 4334 – Trouble

 題目地址: http://acm.hdu.edu.cn/showproblem.php?pid=4334 比賽時,用的是枚舉+二分,時間複雜度 ( 2 * n^3 * logn ),十幾秒的時間,TLE到屎。。。。。。 想改用雜湊,但是不懂腫麼雜湊。。。 賽後問B哥他們。。。   散列雜湊。。。 蒙了,神馬散列?。。。  原來在資料結構課本裡有的。。。 

POJ 3107 – Godfather

 題目地址: http://poj.org/problem?id=3107 DFS遍曆。 利用樹化區間的思想。 能想到這個方法,就很好做了。 枚舉每一個節點為斷點:        1. 那麼其每【一個子節點】=【一顆單獨的樹】。        2. 而【整棵樹】減去【以這個節點為根的樹】=【單獨一棵樹】。  #include<iostream>#include<cstdio>#include<cstring>#define bug

根據二叉樹的先序遍曆和中序遍曆重構二叉樹

想法:分治,根據前序走訪來對中序遍曆進行劃分,分為左右子樹/* * test.cpp * * Created on: Dec 13, 2010 * Author: alfred */#include <iostream>#include <string>using namespace std;struct node {char data;node* left;node* right;node(char data = '/0', node* left =

“Static Import”機制

    J2SE 1.5裡引入了“Static

BNU 4184 – 騎士周遊列國

 題目地址: http://acm.bnu.edu.cn/bnuoj/problem_show.php?pid=4184 直接DFS 肯定 TLE 。 需要加一個剪枝。 #include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;int mp[8][8],n,nn;const int fx[]={1,1,-2,-2,2,2,-1,

stl演算法:next_permutation剖析

在標準庫演算法中,next_permutation應用在數列操作上比較廣泛.這個函數可以計算一組資料的全排列.但是怎麼用,原理如何,我做了簡單的剖析.首先查看stl中相關資訊.函數原型:template<class BidirectionalIterator>   bool next_permutation(      BidirectionalIterator _First,       BidirectionalIterator _Last  

BNU 1440 – 棋盤問題

 題目地址: http://acm.bnu.edu.cn/bnuoj/problem_show.php?pid=1440 類似 N皇后 ,直接 DFS枚舉即可。 #include<stdio.h>#include<string.h>char map[8][9];int res;int y[8],hs[64];void dfs(int i,int n,int m){if(!m){res++;return;}for(;i<n;i++)for(int

POJ 3468 – A Simple Problem with Integers

 題目地址:http://poj.org/problem?id=3468 線段樹初學水題,就步多說了 區間求和,區間更新。 #include<iostream>#include<cstdio>#include<algorithm>#define ll (v<<1)#define rr (v<<1|1)#define tmid ((l+r)>>1)using namespace std;const int maxn=10000

BNU 4304 – 硬幣迷陣

 題目地址: http://acm.bnu.edu.cn/bnuoj/problem_show.php?pid=4304 直接 DFS 枚舉所有可能即可。。 #include<stdio.h>#include<string.h>int s[5][5],res,r[5][5],k[5][5];void output(){ // 這題很早就做出來了。。 查了一小時錯。囧// 錯在最後的輸出 這裡,一直被忽略了,把 r[3][1] 寫成了 r[3][i] 。。。 int

SWUN 1012 – Card

Card 時間限制(普通/Java) : 5000 MS/ 10000 MS          運行記憶體限制 : 65536 KByte總提交 : 169            測試通過 : 32 描述

HDU 4357 – String change

 題目地址: http://acm.hdu.edu.cn/showproblem.php?pid=4357 比賽時YY了挺久,覺得Y出來的木有錯,交上去WA了,囧。。。。 賽後吃飯,回來之後突然想到,還有個特判沒加上。。。 (當len == 2 時的情況。。。)。。。 添上就A了。。。  搓B代碼,就不解釋了。。。 做法很好理解,當len >= 3 時, a數列中的任何一個元素,都可以實現隨意的 +2 或者

HDU 1166 – 敵兵布陣

 題目地址:   http://acm.hdu.edu.cn/showproblem.php?pid=1166 樹狀數組 練手水題,單點更新,區間求和。  #include<iostream>#include<cstdio>using namespace std;int n;int s[51000];void add(int i,int val){while(i<=n){s[i]+=val;i+=i&-i;}}int query(int i){int

HDU 4355 – Party All the Time

 題目地址: http://acm.hdu.edu.cn/showproblem.php?pid=4355 三分~~   比賽時沒看到 題目輸出那裡寫的 四捨五入·~~   WA了幾次~~  當時是GSS寫的~~~。 這裡我自己重新做了一下~~~ #include<iostream>#include<cstdio>#define mul(x,y) ((x)*(x)*(x)*(y))#define abs(x) ((x)<0?0-(x):(x))using

總頁數: 61357 1 .... 19677 19678 19679 19680 19681 .... 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.