- 博客(6)
- 收藏
- 关注
原创 极大极小搜索
#include#includeusing namespace std;int dfs(int m,int mark);int canmoveto(int a,int b);int evaluation();int main(){ int ans,n,randseed; cin>>n; cin>>randseed; srand(randseed); ans=
2017-11-23 08:32:59
200
原创 指针+选太子
可读性有点差,但却是许多组调试后完成的,纪念一下。描述:某皇帝有2m个儿子,现在要从中选出一个做太子,皇帝不知道该把那一个皇子立为太子,于是决定用下面的方法来选出太子,设每个太子的编号分别1、2、3、…、2m,按顺时针方向站成一个圆圈,现在从1号太子开始按顺时针方向数,数到第n个人,把他淘汰出局,然后从他的下一个人开始上述过程,当第m个人被淘汰时,转变方向继续从1开始数,重复上述过程,
2017-10-24 00:30:18
182
原创 字符串大小写逆置(神奇的ascll码)
自己写的第一个稍微按要求来的程序描述:给定一个字符串,全部由英文字母组成 ,要求把该字符串的中的大写字母改为小写,小写字母改为大写。字符长度不超过20Input a string, it is compose of letters, you must be change all the uppercase letters to lowercase and all the l
2017-10-19 23:22:51
521
原创 字符统计对比
描述:输入一行字符(字符个数不超过255),统计其中的小写字母、空格和其他字符的个数(字符中可能存在空格,请用gets()读入。)输入:一行字符串,长度小于255。输出:三个数字,每个一行,分别代表小写字母、空格和其他字符的个数。输入样例:Xiaolan.Lee 1输出样例:814我的野程序#include
2017-10-19 22:42:56
303
原创 对比 未用指针的标准程序+幸运的编号
王歧老师的标准程序//1106幸运的编号#includeusing namespace std;int n, m;//n个人,没次数到m,把这个人拉走int a[10000];void xingyun();void init();void output();int main(){ cin >> n >> m; init(); xingyun();
2017-10-19 09:46:57
304
原创 指针+幸运的编号
#include using namespace std; int main() { int i,n,m; cin>>n>>m; int a[100],*p; p=a; for(i=0;i { *(p+i)=i+1; } i=0; int s=0,k=0;//s记为退出的人数 while
2017-10-19 00:08:24
193
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人