poj 2718 搜尋

Smallest DifferenceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2679 Accepted: 766DescriptionGiven a number of distinct decimal digits, you can form one integer by choosing a non-empty subset of these digits and writing them in some

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

10596 – Morning Walk//歐拉迴路

/*The describe is not clear*/#include<cstdio>#include<cstring>using namespace std;const int maxn = 205;int degree[maxn];int f[maxn];int N,R;int find(int x){ if(x != f[x]) { f[x] = find(f[x]); } return f[x];}int main(){

cf 186 div2 B

B. Ilya and Queriestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIlya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You'

Uva 248 Tree//二叉樹遍曆,遞迴

    這道題剛開始糾結於輸入,還是題刷少了。囧!本來想用strchr函數和指標來操作的,但是在輸入的時候很糾結,就放棄了。這是poj 2255的加強版,不用真正的建樹後在遍曆,直接類比建樹的過程就解決了。    下面是代碼:  #include<stdio.h>#include<string.h>#define MAXN 10010int ans,flag,n;int s1[MAXN],s2[MAXN];int find_root(int b1,int e1,int

poj 3087 類比

Shuffle'm UpTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4557 Accepted: 2167DescriptionA common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker

Uva 297 – Quadtrees//樹,遞迴

題目大意:就是先建兩個樹,然後遍曆這兩個樹。我就叫這種樹為四叉樹吧。難住我的地方就是遞迴建樹,然後是遍曆的時候想多來。具體的看代碼的注釋吧。下面是代碼:#include<stdio.h>#include<string.h>#include<iostream>#define MAXN 100000using namespace std;char s1[MAXN],s2[MAXN];char *s;typedef struct node{ node

poj 2585& zoj 2193

Window PainsTime Limit: 2 Seconds      Memory Limit: 65536 KBBoudreaux likes to multitask, especially when it comes to using his computer. Never satisfied with just running one application at a time, he usually runs nine applications, each in its

poj 3414 搜尋

PotsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8211 Accepted: 3481 Special JudgeDescriptionYou are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i)        fill the pot 

Uva 101 – The Blocks Problem//簡單類比

分析:這道題蠻有意思的,雖然說很簡單,但是可以當做練手吧,鍛煉自己碼代碼的能力。注意:當a和b相等的時候,判定這個輸入不合法,不做任何的操作。#include<stdio.h>#include<string.h>#define MAXN 26int blocks[MAXN][MAXN];int n,order[MAXN],position[MAXN];void init(){ memset(blocks,-1,sizeof(blocks)); for(int

567 – Risk//bfs

因為沒有權值,所以不用使用Floyd演算法求最短路。直接用bfs做。。。#include<cstdio>#include<cstring>using namespace std;const int maxn = 21;int G[maxn][maxn];int vis[maxn][maxn];struct node{ int level; int u;} q[maxn*maxn];int bfs(int s,int e){ int front = 1;

10034 – Freckles\\MST

模板題,可以用kruskal,也可以用最短路。#include<cstdio>#include<string>#include<algorithm>#include<cmath>using namespace std;const int maxn = 5555;int u[maxn],v[maxn],p[maxn];double map[105][2];struct node{ int id; double w;}

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){

10006 – Carmichael Numbers//快速冪模數

/*The analysis of this problem What is a Carmichael number? First it is not a prime; Second it must meet the contition that a^p mod p=a.*/#include<iostream>#include<cstdio>#include<cstdlib>//get a random

數學學習之數字相關(持續更新啊!)

一、數論初步        1)、歐幾裡德演算法及其擴充                  歐幾裡德演算法也叫輾轉相除法。根據gcd(a,b)=gcd(b,a%b)可以由遞迴寫出該演算法。                  int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }        2)、素數相關                   可用Eratosthenes篩法構造素數表。 void

UVa 11538 – Chess Queen//計數

                                                                      給定的m*n的棋盤,放置黑白皇后的方式從三個方面考慮。行,列,對角線。行:選取一個皇后放置一個皇后有m*n中方式,接下來放置另一個皇后,有(n-1)中方式,所以按行考慮有n*m*(n-1)種方式。列:同理可得有n*m*(m-1)中方式。對角線: 對角線有兩個方向的,”/“和”\“兩個方向,先考慮一個方向。                 每條對角線的長度為:

Uva 699 – The Falling Leaves//二叉樹

題目大意:從根結點開始標號,向左標號減一,向右標號加一。下面是代碼:#include<stdio.h>#include<string.h>#define MAXN 1000int ans[MAXN];int T;int build(int n,int num){ ans[n]+=num; int s; scanf("%d",&s); if(s!=-1) build(n-1,s); scanf("%d",&s);

Uva 572 – Oil Deposits//深搜,圖

題目很簡單,資料不大,直接深搜。#include<stdio.h>#include<string.h>#define MAXN 105int map[MAXN][MAXN];int n,m;void dfs(int i,int j){ if(!map[i][j]) return; map[i][j]=0; dfs(i+1,j); dfs(i-1,j); dfs(i-1,j-1); dfs(i-1,j+1); dfs(i+1,j-1

Poj 3685(經典二分)

MatrixTime Limit: 6000MS Memory Limit: 65536KTotal Submissions: 4150 Accepted: 1007DescriptionGiven a N × N matrix A, whose element in the i-th row andj-th columnAij is an number that equals i2 + 100000 ×i +j2 - 100000 × j + i × j, you are to find

uva 11294 – Wedding(TwoSAT)

文章目錄 Sample InputPossible Output for Sample Input Problem E: WeddingUp to thirty couples will attend a wedding feast, at which they will be seated on either side of a long table. The bride and groom sit at one end,

總頁數: 61357 1 .... 7792 7793 7794 7795 7796 .... 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.