/** 大意:给定一组x[],y[],z[] 确定有没有两个不同的x[i], x[j] 看是否存在一个ID使得 y[i]<=ID%x[i]<=z[i] y[j]<=ID%x[j]<=z[j] 设ID%x[i] = a ID%x[j] = b ===〉ID+x[i]*x=a, ID+x[j]*y = b; 两式相减得 x[j]*y - x[i]*x = b-a; 若是有解 就是(b-a)%gcd(x[i],x[j]) == 0 就是看b-a的范围内是否有数是 gcd(x[i],x[j…
题意:求一个无向图的,去掉两个不同的点后最多有几个连通分量. 思路:枚举每个点,假设去掉该点,然后对图求割点后连通分量数,更新最大的即可.算法相对简单,但是注意几个细节: 1:原图可能不连通. 2:有的连通分量只有一个点,当舍去该点时候,连通分量-1: 复习求割点的好题! #include<iostream> #include<cstdio> #include<vector> using namespace std; int n,m; vector<vector&…
题目链接:http://icpc.njust.edu.cn/Contest/194/Problem/B B - TWO NODES 时间限制: 10000 MS 内存限制: 65535 KB 问题描述 Suppose that G is an undirected graph, and the value of  stab is defined as follows: Among the expression, G-i,-j  is the remainder after removing no…
/** 大意:给定一个色子,有n个面,每一个面上有一个数字,在其中的m个面上有特殊的颜色,当掷出的色子出现这m个颜色之一时,可以再掷一次..求其最后的期望 思路:假设 期望为ans 4 ans = 1/n*(a[b[1]]+ans)+1/n*(a[b[2]]+ans)+....+1/n*(a[b[m]]+ans) +...+1/n*(a[k]).... 5 ans = m/n*ans+1/n*(a[1]+a[2]+a[3]+...a[n]) 6 ans = m/n*ans+sum/n 7 ans…
/** 大意: 给定区间(a,b), 将其转化为二进制 计算从a+(a+1)+(a+2)....+(a+b-1),一共有多少次进位 思路: 将(a,b)区间内的数,转化为二进制后,看其每一位一共有多少个1 可知最低位循环为2,第二位循环为4 ---〉 所以每一位的1的个数为 : 假设为第三位 (n-n%8)/8*8/2===>(n-n%8)/2 ------> 如果n%8 大于8/2 那么应该再加上 n%8-8/2 **/ #include <iostream> #include…
https://vjudge.net/problem/Gym-102222K 题意:给定N点M边的无向图,每个点有点权.  点覆盖表示某个点集S{}覆盖了所有的边,其贡献是S中点权之积. 现在让你求所有满足条件的点集贡献之和.N<36,保证无重边,自环. 思路:点覆盖选谁不选谁肯定状压,N有36再来个折半,然后想办法合并两边.可以枚举左边那堆点的状态,对于左边没选中的那些点,若他连接的其他左边点都被选中了(否则该状态舍去), 求出他连接的右边那些点,即是右边的必选点,那么右边就可以选该必选点集或…
Hypersphere Time Limit: 1 Second       Memory Limit: 32768 KB In the world of k-dimension, there's a large hypersphere made by mysterious metal. People in the world of k-dimension are performing a ceremony to worship the goddess of dimension. They ar…
Walk Through Squares Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 200    Accepted Submission(s): 57 Problem Description   On the beaming day of 60th anniversary of NJUST, as a military colleg…
Divide Groups Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 423    Accepted Submission(s): 161 Problem Description   This year is the 60th anniversary of NJUST, and to make the celebration mor…
Count The Pairs Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 277    Accepted Submission(s): 150 Problem Description   With the 60th anniversary celebration of Nanjing University of Science…