第 7 章 暴力求解法
文章平均质量分 84
苏摩夜
持之以恒
展开
-
UVA - 11059 Maximum Product
Problem D - Maximum ProductTime Limit: 1 secondGiven a sequence of integers S = {S1, S2, ..., Sn}, you should determine what is the value of the maximum positive product involving consecutive term原创 2014-09-18 13:24:36 · 415 阅读 · 0 评论 -
UVA - 639 Don't Get Rooked
Don't Get Rooked In chess, the rook is a piece that can move any number of squares vertically or horizontally. In this problem we will consider small chess boards (at most 44) that can原创 2014-10-18 13:18:16 · 414 阅读 · 0 评论 -
UVA - 10474 Where is the Marble?
#include #include #include #include #define N 10001using namespace std;int cmp(const void *x,const void *y) { return *(int *)x - *(int *)y;}int n,m,t;int a[N];int flag,cou = 0;int main原创 2014-10-17 21:27:29 · 326 阅读 · 0 评论 -
HDU - 2553 N皇后问题
#includeint tot=0,row,line[10],n;void search(int row) //递归搜索可行解{ int i,j; if(row==n) tot++; //当row=n时,说明每一行的皇后都不冲突,即为可行解 else for(i=0;i<n;i++) { int ok=1;原创 2014-10-16 18:15:46 · 661 阅读 · 0 评论 -
UVA - 216 Getting in Line
Getting in Line Computer networking requires that the computers in the network be linked.This problem considers a ``linear" network in which the computers are chained together so原创 2014-10-17 21:26:07 · 409 阅读 · 0 评论 -
UVA - 110 Meta-Loopless Sorts
Meta-Loopless Sorts Background Sorting holds an important place in computer science. Analyzing and implementing various sorting algorithms forms an important part of the education of原创 2014-10-15 01:37:57 · 399 阅读 · 0 评论 -
UVA - 146 ID Codes
ID Codes It is 2084 and the year of Big Brother has finally arrived, albeit a century late. In order to exercise greater control over its citizens and thereby to counter a chronic breakd原创 2014-10-14 23:25:12 · 486 阅读 · 0 评论 -
UVA - 729 The Hamming Distance Pro
The Hamming Distance Problem The Hamming distance between two strings of bits (binary integers) is the number of corresponding bit positions that differ. This can be found by using XOR o原创 2014-10-15 00:05:58 · 480 阅读 · 0 评论 -
UVA - 10098 Generating Fast
Problem CGenerating Fast, Sorted PermutationInput: Standard InputOutput: Standard Output Generating permutation has always been an important problem in computer science. In this problem yo原创 2014-10-14 23:38:26 · 5812 阅读 · 0 评论 -
UVA - 193 Graph Coloring
Graph Coloring You are to write a program that tries to find an optimal coloring for a given graph. Colors are applied to the nodes of the graph and the only available colors are black a原创 2014-10-29 17:56:09 · 976 阅读 · 0 评论 -
UVA - 725 Division
Write a program that finds and displays all pairs of 5-digit numbers that between them use the digits0 through 9 once each, such that the first number divided by the second is equal to an integerN原创 2014-09-17 23:02:06 · 327 阅读 · 0 评论 -
UVA - 10167 Birthday Cake
Problem G. Birthday Cake BackgroundLucy and Lily are twins. Today is their birthday. Mother buys a birthday cake for them.Now we put the cake onto a Descartes coordinate. Its center is a原创 2014-09-20 13:01:58 · 392 阅读 · 0 评论 -
UVA - 10976 Fractions Again?!
It is easy to see that for every fraction in the form (k > 0), we can always find two positive integersx and y, x ≥y, such that: .Now our question is: can you write a program that counts h原创 2014-09-20 10:20:25 · 422 阅读 · 0 评论 -
UVA - 539 The Settlers of Catan
The Settlers of Catan Within Settlers of Catan, the 1995 German game of the year, players attempt to dominate an island by building roads, settlements and cities across its uncharted wil原创 2014-10-20 15:08:10 · 423 阅读 · 0 评论