随笔分类 -  STL函数

摘要:好吧,水了有点要注意了,用ges(..)超时, scanf(...)就A掉了。。。#include <iostream>#include <stdio.h>#include <string>#include <set>using namespace std;int main (){ set<string> st; pair< set<string>::iterator, bool > pr; char str[25]; int n, m; while (scanf("%d%d", & 阅读全文
posted @ 2013-04-29 10:28 旅行的蜗牛 阅读(144) 评论(0) 推荐(0)
摘要:题意:逻辑运算题,最多有5个变量,依次枚举就可以AC了kANCEa && ba || b!a!a || ba ==b思路:之前是用递归写的,但是WA或是超时,郁闷。。。后来在网上参考了别人的代码,用栈一次AC。10962407NY_lv103295Accepted208K16MSC++1648B2012-10-27 20:08:57用栈AC代码#include <iostream>#include <stack>//#include <fstream>#include <string>using namespace std;//o 阅读全文
posted @ 2012-10-27 20:19 旅行的蜗牛 阅读(325) 评论(0) 推荐(0)
摘要:题意:给定n, p, 求pow(p, 1/n)10955211NY_lv102109Accepted196K0MSC++192B2012-10-25 18:56:50View Code #include <iostream>#include <math.h>using namespace std;int main(){ double n, p; while (scanf("%lf %lf", &n, &p) !=EOF) { printf("%0.0lf\n", pow(p, 1/n)); } return 0;} 阅读全文
posted @ 2012-10-25 18:59 旅行的蜗牛 阅读(202) 评论(0) 推荐(0)
摘要:题意:给一个树组,长度为1,2,3。。。n ,求全排序里面第m小的序列。思路:调用库函数next_permutation 水过其中库中另一函数prev_permutation与next_permutation相反,由原排列得到字典序中上一次最近排列。69395642012-10-18 11:10:31Accepted102731MS260K306 BC++罗维View Code 1 #include <iostream> 2 #include <algorithm> 3 using namespace std; 4 5 int main() 6 { 7 int f[10 阅读全文
posted @ 2012-10-18 11:18 旅行的蜗牛 阅读(151) 评论(0) 推荐(0)