摘要: 排序可能会用到的一个函数,来自C++STC,直接调用可以说很方便的解决了一些排序问题 这是一个求一个排序的下一个排列的函数,可以遍历全排列,要包含头文件 下面是以前的笔记 与之完全相反的函数还有prev_permutation (1) int 类型的next_permutation ... 阅读全文
posted @ 2016-04-11 16:15 弃用博客 阅读(453) 评论(0) 推荐(0)
摘要: 水题,关键格式问题,每行数据换行,但是题目又没有要求最后一行不换行,所以别想多了。 #include using namespace std;int main(){ int T,t,i,j; int a,b,c; cin>>T; for(i = 1;i>a>>b>>c; t = 0;... 阅读全文
posted @ 2016-04-11 11:01 弃用博客 阅读(144) 评论(0) 推荐(0)
摘要: 水题,坑,开始数组给小了,一支PE,后开始用动态delete位置放错,放在while循环里面只申请了一片位置,多次释放会出错,一直WA 一开始的数组#include #include #include using namespace std;char str[105];int main(){ ... 阅读全文
posted @ 2016-04-10 17:54 弃用博客 阅读(122) 评论(0) 推荐(0)
摘要: 超级简单的一道题,超级水 #include using namespace std;int main(){ int T; int Y,N; cin>>T; while(T--){ cin>>Y>>N; int cnt = 0; for(;cnt<N;Y++) ... 阅读全文
posted @ 2016-04-10 00:17 弃用博客 阅读(113) 评论(0) 推荐(0)
摘要: 一道水题,判断N和M互不互质就行了,如果不互质,有些人Haha是不能查询的 #include using namespace std;int main(){ int N,M,tem; while(cin>>N>>M){ if(N==-1&&M==-1) ... 阅读全文
posted @ 2016-04-09 21:14 弃用博客 阅读(155) 评论(0) 推荐(0)
摘要: 简单的字符串处理,第一种方法就是用数组存这些字符串,用 j 来记录进度的长度,注意gets()会在字符串的结束添加'\0'。 #include #include #include using namespace std;char str[1005];using namespace std;i... 阅读全文
posted @ 2016-04-08 20:03 弃用博客 阅读(162) 评论(0) 推荐(0)
摘要: #include using namespace std; int main(){ int n,u,d,sum; while(cin>>n>>u>>d&&n){ int k = (n-u)/(u-d); if( (n-u)%... 阅读全文
posted @ 2016-04-07 16:23 弃用博客 阅读(144) 评论(0) 推荐(0)
摘要: #include using namespace std; int main(){ int n,sum,m,j,k; cin>>m; while(m--){ cin>>n; sum = 0; for... 阅读全文
posted @ 2016-04-07 15:37 弃用博客 阅读(121) 评论(0) 推荐(0)
摘要: #includeusing namespace std;int main(){int s1[4]={0,7,6,5}; //根据n3%4,判断此包中填入3*3,尽可能填2*2后还能填入1*1的个数(数组下标分别对应取余的0,1,2,3)int s2[4]={0,5,3,1}; //根据n3%4,... 阅读全文
posted @ 2016-04-06 15:03 弃用博客 阅读(90) 评论(0) 推荐(0)
摘要: (转自简书),再根据自己经验加以补充 一、 数据类型及运算 求补码 原码的基础上, 符号位不变, 其余各位取反, 最后+1原码转补码不考虑符号位补码转原码,符号位不参与运算取反后 + 1 == 取反前 - 1 科学计数法表示 1.8 * 10^11 --> 1.8E119.34 * 10... 阅读全文
posted @ 2016-04-06 14:58 弃用博客 阅读(216) 评论(0) 推荐(0)