题目描述: Description Given a specified total t and a list of n integers, find all distinct sums using numbers from the list that add up to t. For example, if t = 4, n = 6, and the list is [4, 3, 2, 2, 1, 1], then there are four different sums that equal…
http://wikioi.com/problem/1229/ 赤裸裸的水题啊. 一开始我认为不用用完全部的牌,以为爆搜会tle.. 可是我想多了. 将所有状态全部求出,排序后暴力判断即可. (水题有点严重啊) #include <cstdio> #include <algorithm> using namespace std; int n, m; int h[440000], cnt, a[12]; bool vis[12]; void dfs(int x, int sum, i…
SCU 4437 Carries Time Limit:0MS Memory Limit:0KB 64bit IO Format:%lld & %llu Practice Description Carries frog has nn integers a1,a2,…,ana1,a2,…,an, and she wants to add them pairwise. Unfortunately, frog is somehow afraid of carries (进位).…
Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only…
HDU 1087 Input contains multiple test cases. Each test case is described in a line as follow:N value_1 value_2 …value_N It is guarantied that N is not more than 1000 and all value_i are in the range of 32-int.A test case starting with 0 terminates th…
简直智障,上一题V题,样例输出里面的“Case:”不要输出,到了这题又是要输出的了 #include<iostream> using namespace std; int num[100000]; int main() { int T; for(int i=32;i<100;i++){ num[i*i]=1; } cin>>T; int n; int k=0; while(T--){ cin>>n; k++; int a,b,c,d; a=n/1000; b=n/…
POJ - 1220 进制转换 import java.io.*; import java.util.*; import java.math.*; public class Main { public static int GetNum(char c) { if (Character.isDigit(c))return c-'0'; if (Character.isUpperCase(c))return c-'A'+10; if (Character.isLowerCase(c))return…
ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: 1001 Sum Problem 相加1002 A + B Problem II 模拟人工加法-精度计算 1008 Elevator 很水,但是情况要考虑全面…
N皇后问题 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6905 Accepted Submission(s): 3128 Problem Description 在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上.你的任务是,对于给定的N,求出有…