摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;int main(){ //freopen("D:\\t.txt", "r", stdin); int c, abc, abc2, a, b; while (scanf("%d%d%d", &c, &abc, &abc2)!= EOF) { a = (abc 阅读全文
posted @ 2011-04-30 16:51 金海峰 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;int main(){ //freopen("D:\\t.txt", "r", stdin); int m, p, n, c; while (scanf("%d%d%d%d", &n, &m, &p, &c) != EOF && !( 阅读全文
posted @ 2011-04-30 16:08 金海峰 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 简单题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 金海峰 阅读(175) 评论(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 金海峰 阅读(208) 评论(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 金海峰 阅读(145) 评论(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 金海峰 阅读(316) 评论(0) 推荐(0) 编辑