摘要:题目描述: 回文串,是一种特殊的字符串,它从左往右读和从右往左读是一样的。崔学长认为回文串才是完美的(但吕学弟不这样认为)。现在给你一个串,它不一定是回文的,请你计算最少的交换次数使得该串变成一个完美的回文串。 交换的定义是:交换两个相邻的字符 例如mamad 第一次交换 ad : mamda 第二
阅读全文
摘要:只是打卡: #include <stdio.h> #include <ctype.h> #include <string.h> #include <math.h> int y=0; void inverse(char str[1000],char b[1000],int m,int n,int k)
阅读全文
摘要:考到了函数的递归+回溯,很有意思 俺的做法: #include <stdio.h> #include <ctype.h> #include <string.h> #include <math.h> char b[1000]; char c[1000]; char d[1000]; char a[10
阅读全文
摘要:一道很有趣的题目,考了小车的行动,同时要设置方向号来进行偏移方向 俺的做法: #include <stdio.h> #include <ctype.h> #include <string.h> #include <math.h> int main() { int x=0,y=0; int dirto
阅读全文
摘要:最近两天都没有更新博客力( 其实是去学了些算法,算是对计算机科学有了全新的认识吧(我之前在课本学的是什么勾八玩意儿) CP1055 有多少个数的和是素数(经典的回溯算法,暴力枚举) 俺的做法:#include <stdio.h> #include <ctype.h> #include <string
阅读全文
摘要:练了练双向搜索,很有意义的尝试 俺的做法: #include <stdio.h> #include<stdlib.h> #include <ctype.h> #include <string.h> int main() { int n,m=0,x=0; int p; int a[100]; int
阅读全文
摘要:#CP1025. 陈述句变成疑问句 还是有点小bug后面再调吧 #include <stdio.h> #include <ctype.h> #include <string.h> int main() { char a[100]; char b[100]; //第一个单词 char c[100];
阅读全文
摘要:#ACM2021_23. 摘柿子:一道很简单的排序题,估计是送分题( 俺的做法: #include <stdio.h> #include <stdlib.h> #define N 100 #define M 100 int main() { int n;//n为柿子个数 int a[100];//敲
阅读全文
摘要:又是一道小题,(但是也不是空格作为分割符,范围更广)本质上还是连续字符串,又考了判断嵌套啊 俺的做法: #include <stdio.h> #include <ctype.h> #include <string.h> int main() { char a[100];//用于存储刚开始的字符串 c
阅读全文
摘要:一道卡了我好几天的题目(题干绝不是你看起来的这么简单,因为并不是简单的空格判定) 我的做法: #include <stdio.h> #include <ctype.h> #include <string.h> #define MAX_NUM 128 int main() { char s[MAX_N
阅读全文
摘要:本想做个小题,没想到牵扯出了大数阶乘(悲 本质上还是极限 俺的做法: #include <stdio.h> int change(int m); int main() { int a[20001]; int m,u; int temp,digit,n,i,j=0; int sum=0; scanf(
阅读全文
摘要:今天整了个小题,但可惜超时了(悲 我之前的做法(暴力枚举,但超时) #include <stdio.h> #include <string.h> int main(int argc, const char *argv[]) { int a,b,c,d,e,sum,k; int count=0; sc
阅读全文
摘要:我的做法: #include <stdio.h> int Magic(int m); int main() { int m, ret; printf("Input a sum:"); scanf("%d", &m); ret = Magic(m); if (ret != 1) { printf("T
阅读全文
摘要:P100 输出倒三角形图案 #include <stdio.h> #define MAX_LEN 10 #define N 150 #include<string.h> #include<stdlib.h> #include <stdio.h> int main() { int n, i, j; s
阅读全文
摘要:我的做法: #include <stdio.h> #define MAX_LEN 10 #define N 150 #include<string.h> #include<stdlib.h> int main() { int n,m,j=0,l=0; int a[100]; int b[100];
阅读全文
摘要:循环嵌套法: #include <stdio.h>#define MAX_LEN 10#define N 150#include<string.h>#include<stdlib.h>int judge(int i);int main(){ int n,i,k; int sum=0; scanf("
阅读全文