题目链接:http://acm.nyist.edu.cn/JudgeOnline/problem.php?pid=927 代码: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <algorithm> #include <iostream> using namespace std; int n,k; ]; ; ]…
The partial sum problem 时间限制:1000 ms  |  内存限制:65535 KB 难度:2 描写叙述 One day,Tom's girlfriend give him an array A which contains N integers and asked him:Can you choose some integers from the N integers and the sum of them is equal to K. 输入 There are mul…
/* Name: NYOJ--927--The partial sum problem Author: shen_渊 Date: 15/04/17 19:41 Description: DFS,和 NYOJ--1058--dfs--部分和问题 基本一致,递归的i+1注意了,其他没什么 */ #include<cstring> #include<iostream> using namespace std; void dfs(int); ],vis[]; int n,k,sum,fla…
结束了三分搜索的旅程 我开始迈入深搜的大坑.. 首先是一道比较基础的深搜题目(还是很难理解好么) POJ 1564 SUM IT UP 大体上的思路无非是通过深搜来进行穷举.匹配 为了能更好地理解深搜 可以尝试去画一下二叉树理解一下,查看遍历的路径 代码还是百度到别人的自己再参悟- -佩服别人的功底啊 先上代码: /*POJ 1546 Sum it up*/ # include<iostream> # include<algorithm> # include<cstdio&g…
Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains either water ('W') or dry land ('.'). Farmer…
描述 One day,Tom’s girlfriend give him an array A which contains N integers and asked him:Can you choose some integers from the N integers and the sum of them is equal to K. 输入 There are multiple test cases. Each test ≤N≤),represents the array contains…
Safecracker Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12702    Accepted Submission(s): 6581 Problem Description === Op tech briefing, 2002/11/02 06:42 CST === "The item is locked in a Klei…
Prime Ring Problem Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 34347 Accepted Submission(s): 15188 Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1,…
描述 One day,Tom’s girlfriend give him an array A which contains N integers and asked him:Can you choose some integers from the N integers and the sum of them is equal to K.  输入 There are multiple test cases. Each test case contains three lines.The fir…
算法:搜索 描述 One day,Tom's girlfriend give him an array A which contains N integers and asked him:Can you choose some integers from the N integers and the sum of them is equal to K. 输入There are multiple test cases. Each test case contains three lines.The…