POJ 1129 Channel Allocation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 14191   Accepted: 7229 Description When a radio station is broadcasting over a very large area, repeaters are used to retransmit the signal so that every receive…
Channel Allocation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 13173   Accepted: 6737 Description When a radio station is broadcasting over a very large area, repeaters are used to retransmit the signal so that every receiver has a s…
Channel Allocation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 15546   Accepted: 7871 Description When a radio station is broadcasting over a very large area, repeaters are used to retransmit the signal so that every receiver has a s…
题目:http://poj.org/problem?id=1129 题意:求最小m,使平面图能染成m色,相邻两块不同色由四色定理可知顶点最多需要4种颜色即可.我们于是从1开始试到3即可. #include <iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<stack> #include<queue> #include<iomanip&…
题目: http://poj.org/problem?id=1129 开始没读懂题,看discuss的做法,都是循环枚举的,很麻烦.然后我就决定dfs,调试了半天终于0ms A了. #include <stdio.h> #include <string.h> ][], vis[][]; int n, ans; void calc() { ; ; i < ; i++) { ; j < n; j++) { if(vis[j][i]) { cnt++; break; } }…
http://poj.org/problem?id=1129 import java.util.*; import java.math.*; public class Main { public static boolean flag=false; public static int ans=0; public static void main(String []args) { Scanner cin=new Scanner(System.in); int n; String str; whil…
题意: N个中继站,相邻的中继站频道不得相同,问最少需要几个频道. 输入输出: Sample Input 2 A: B: 4 A:BC B:ACD C:ABD D:BC 4 A:BCD B:ACD C:ABD D:ABC 0 Sample Output 1 channel needed. 3 channels needed. 4 channels needed. 题意抽象+思路: 一张有N个点的无向图,对每个点进行染色,相邻的点颜色不得一致,最少需多少种颜色.DFS即可. 代码: <span s…
题意:输入正整数n(1<=n<=1000),问最少需要几次乘除法可以从x得到x的n次方,计算过程中x的指数要求是正的. 题解:这道题,他的结果是由1经过n次加减得到的,所以最先想到的就是暴力回溯,其中的剪枝函数,首先不能得到重复的数,其次深度有上限,上限是n-1,还有,如果当前序列的最大数乘以2的(dep-cnt)(dep与cnt分别表示深度上限和当前深度)次方小于n,则剪枝.但是这样的时间复杂度还是特别高,所以又想到了另外的方法,就是先列出深度,然后找在这个深度里是否存在一个方法得到n 代码…
Channel Allocation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 14601   Accepted: 7427 Description When a radio station is broadcasting over a very large area, repeaters are used to retransmit the signal so that every receiver has a s…
[题目描述] An addition chain for n is an integer sequence with the following four properties: a0 = 1 am = n a0 < a1 < a2 < ... < am-1 < am For each k (1<=k<=m) there exist two (not necessarily different) integers i and j (0<=i, j<=k…