赵乐ACM

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年4月11日

摘要: 1. 枚举,注意里边的几个剪枝,标在代码中了2. 我的代码:/* ID: dollar4 PROG: crypt1 LANG: C++ */ #include #include #include #include #include using namespace std; int num[10], n; bool cmp(int a, int b) { return a > n; int i, j, k, l, m, s1, s2, s3, s4, s5; int cnt = 0, mm, nn, mn; for (i = 0; i > num[i]... 阅读全文
posted @ 2012-04-11 23:42 赵乐ACM 阅读(142) 评论(0) 推荐(0)

摘要: 1. 输入带回车符,空格,标点符号的字符串:while (fin >> temp) { str += temp; str += " "; } unsigned int len = str.size(); str.resize(len - 1);2. 判断是不是回文3. 以下是代码:/* ID: dollar41 PROG: calfflac LANG: C++ */ #include #include #include #define maxn 20010 using namespace std; char str1[maxn],str2[max... 阅读全文
posted @ 2012-04-11 22:34 赵乐ACM 阅读(140) 评论(0) 推荐(0)

摘要: 1. 这道题想多了,想得很复杂,其实就是把输入的一排数按照从小到大的顺序排列,然后得到相邻两个数之间的差,按从大到小的顺序排序,用这个数组所有元素的和减去前m-1个数,然后再加上m,就得到结果2. 以下是我的代码:/* ID: dollar4 PROG: barn1 LANG: C++ */ #include #include #include #include #include using namespace std; bool cmp1(int a, int b) { return a > b; } bool cmp2(int a, int b) { retur... 阅读全文
posted @ 2012-04-11 16:26 赵乐ACM 阅读(148) 评论(0) 推荐(0)

摘要: 1. 贪心,其他没啥说的2. 我的代码:/* ID: dollar4 PROG: milk LANG: C++ */ #include #include #include #include #include using namespace std; struct Node { int price; int num; } node[5000]; bool cmp(Node a, Node b) { return a.price > n >> m; for (i = 0; i > node[i].price >> node[i].num; sor... 阅读全文
posted @ 2012-04-11 10:25 赵乐ACM 阅读(165) 评论(0) 推荐(0)

摘要: 1. 直接用了上道题的函数,另外,进制转换:string trans(int a) { string str1 = ""; int tmp; while (a) { tmp = a % base; if (tmp #include #include #include #include using namespace std; int n, s; bool checkp(string str) { int len = str.size(); for (int i = 0; i > n >> s; ... 阅读全文
posted @ 2012-04-11 10:17 赵乐ACM 阅读(158) 评论(0) 推荐(0)