上一页 1 ··· 156 157 158 159 160 161 162 163 164 ··· 182 下一页
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;int main(){ //freopen("D:\\t.txt", "r", stdin); int n, k; while (scanf("%d%d", &n, &k) != EOF) { int ans = n + (n / (k - 1)); if (n % 阅读全文
posted @ 2011-04-30 15:57 undefined2024 阅读(179) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;int count(int x){ int ret = 0; while (x > 0) { if (x % 2 == 1) ret++; x /= 2; } return ret;}int main(){ //freopen("D:\\t.txt", "r", stdin); int n; w 阅读全文
posted @ 2011-04-30 15:47 undefined2024 阅读(213) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>#include <cmath>using namespace std;int main(){ //freopen("D:\\t.txt", "r", stdin); int n; scanf("%d", &n); int m = floor(sqrt(n * 2)); int ans = 0; fo 阅读全文
posted @ 2011-04-30 15:32 undefined2024 阅读(151) 评论(0) 推荐(0)
摘要: 字符串处理,还是用string类比较容易,先将字符串用million和thousand切分成三段,然后用同样的方法处理这三段即可。注意输入数据结尾有多余空行View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;string name[] ={ "one", "two", "three", "four", "fi 阅读全文
posted @ 2011-04-30 14:58 undefined2024 阅读(328) 评论(0) 推荐(0)
摘要: 二分图的最小顶点覆盖等于最大匹配。所以直接用匈牙利算法。建图时,每个mode作为一个节点,每个作业是连接两个mode的一条边。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;const int MAXN = 105;int uN, vN; // u, v数目,要初始化!!!bool g[MAXN][MAXN]; // g[i][j] 表示xi与yj相连int xM[MAXN], yM[MAXN 阅读全文
posted @ 2011-04-21 16:46 undefined2024 阅读(170) 评论(0) 推荐(0)
上一页 1 ··· 156 157 158 159 160 161 162 163 164 ··· 182 下一页