题 Description soda has a set $S$ with $n$ integers $\{1, 2, \dots, n\}$. A set is called key set if the sum of integers in the set is an even number. He wants to know how many nonempty subsets of $S$ are key set.   Input There are multiple test cases…
http://acm.hdu.edu.cn/showproblem.php?pid=5363 Key Set Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 549    Accepted Submission(s): 338 Problem Description soda has a set S with n integers {…
题 Description soda has a set $S$ with $n$ integers $\{1, 2, \dots, n\}$. A set is called key set if the sum of integers in the set is an even number. He wants to know how many nonempty subsets of $S$ are key set.   Input There are multiple test cases…
2015 HDU 多校联赛 5363 Key Set 题目: http://acm.hdu.edu.cn/showproblem.php? pid=5363 依据前面给出的样例,得出求解公式 fn = 2^(n-1) - 1, 数据量大,实际就是求幂次方. 可用分治法求解.复杂度O(nlogn) // 分治法求高速幂 #include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; const int M…
HDU 3313 Key Vertex 题目链接 题意:一个有向无环图.求s,t之间的割点 思路:先spfa找一条最短路出来,假设不存在.就n个都是割点. 然后每次从s进行dfs,找到能经过最短路上的最远点.然后这个点就是割点.然后下次在以这个为起点dfs,不断迭代直到找到t为止 代码: #include <cstdio> #include <cstring> #include <vector> #include <queue> #include <a…
这是Thinking in java 中的一道题,下面是我的解决方案: package test; import java.util.LinkedList; import java.util.ListIterator; /** * * 创建一个LinkedList,然后在其中插入多个值,确保每个值都插入到List中间(偶数中间两个数之一,奇数在正中间) * */ public class InsertInMiddle { public static void main(String[] args…
No Pain No Game Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2000    Accepted Submission(s): 851 Problem Description Life is a game,and you lose it,so you suicide. But you can not kill yours…
Group Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1959    Accepted Submission(s): 1006 Problem Description There are n men ,every man has an ID(1..n).their ID is unique. Whose ID is i and i…
这个题目套公式 2^(n-1)-1,再来个快速幂基本上就可以AC了 写这个题目的: 公式容易推到错: 容易写成 2^n-1/2...这样写出来结果也不错  但是一直哇 AC: #include<iostream> #include<cstdio> #include<cstring> #define N 1000000007 using namespace std; typedef long long ll; int pow(ll x,ll y) { ll res=; w…
Time Limit: 2000/1000 MS (Java/Others)   Memory Limit: 131072/131072 K (Java/Others) Problem Description soda has a set S with n integers {1,2,…,n}. A set is called key set if the sum of integers in the set is an even number. He wants to know how man…