摘要:
//这题不难,甚至可以称水题中的水题了,可我居然在这道题上,也不是一气呵成地完成,说明基础还是不够扎实,思维也不灵活 #include using namespace std;const int N = 105;char word[N];int getdistance... 阅读全文
posted @ 2017-08-28 16:54
mofushaohua
阅读(185)
评论(0)
推荐(0)
摘要:
/* 这题其实并不难,背包问题,属于动态规划中的简单题 以及,后来发现有个blog上,做了不错的优化 http://www.cnblogs.com/wd-one/p/4480433.html 在输入w、v数组时,同时可以计算出所有输入数据中,得到的最大的单... 阅读全文
posted @ 2017-08-28 16:53
mofushaohua
阅读(153)
评论(0)
推荐(0)
摘要:
//挑战P33// 输入 /* 注意下,使用gets()函数时,可能导致WA 原因及应对见 http://blog.csdn.net/qwb492859377/article/details/48323443 但是,能不用尽量不用吧!*/#include usi... 阅读全文
posted @ 2017-08-28 16:52
mofushaohua
阅读(109)
评论(0)
推荐(0)
摘要:
//有一句话很容易忽视入坑,"Candies, which guys got from each other, they don't consider as their own."//他们并不把对方给的,当作是自己的,相当于只是做减法,不必做加法,一开始审题不清,忽视... 阅读全文
posted @ 2017-08-28 16:51
mofushaohua
阅读(141)
评论(0)
推荐(0)
摘要:
//其实也算水题,关键是要耐心做,不要浮躁#include #include #include #include using namespace std;const int maxn = 205;string name[maxn];int ans[maxn];int ... 阅读全文
posted @ 2017-08-28 16:49
mofushaohua
阅读(133)
评论(0)
推荐(0)
摘要:
//本来想用数组,结果RE,后来发现只是需要判定最后一个,并不需要数组//可是,然后就,WA了.../*WA#include #include #include using namespace std;typedef long long ll;int n;int ma... 阅读全文
posted @ 2017-08-28 16:47
mofushaohua
阅读(146)
评论(0)
推荐(0)
摘要:
/*一开始没怎么想,直接就用一想就能想到的方法,果不其然,TLETLE代码:#include #include #include using namespace std;typedef long long ll;ll n;int main(){ int a, x; w... 阅读全文
posted @ 2017-08-28 16:45
mofushaohua
阅读(152)
评论(0)
推荐(0)
摘要:
/*非常值得重新重做的概率题,化连续为离散,分为(2^M +1)个区间,double型的赌注,则用该区间内的int型来代替,反正效果一样(最终得到的概率是相等的)等到要输出prv[i]时,再去找在dp数组中,该本金对应的是(2^M+1)个区间中的哪个区间*/#incl... 阅读全文
posted @ 2017-08-28 13:31
mofushaohua
阅读(155)
评论(0)
推荐(0)
摘要:
//收获:运用isdigit()函数,解决了元素后面的原子个数可能有两位的情况。同时,每次遇到元素字母,计数工作都由函数完成,简化代码//值得一提的是,这题后来又被我写了一次,充分利用了数组之间的一一对应,减少了许多代码...简洁许多啦!//借鉴了下面blog的部分思... 阅读全文
posted @ 2017-08-28 13:29
mofushaohua
阅读(125)
评论(0)
推荐(0)
摘要:
//并查集的应用#include using namespace std;const int N = 2e5 + 5;int f[N];int color[N];vectornum[N];int findx(int x){ return ( x == f[x]? x:... 阅读全文
posted @ 2017-08-28 13:28
mofushaohua
阅读(118)
评论(0)
推荐(0)