摘要:
題目描述: 回文串,是一種特殊的字符串,它從左往右讀和從右往左讀是一樣的。崔學長認為回文串才是完美的(但呂學弟不這樣認為)。現(xiàn)在給你一個串,它不一定是回文的,請你計算最少的交換次數(shù)使得該串變成一個完美的回文串。 交換的定義是:交換兩個相鄰的字符 例如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)
閱讀全文
摘要:
考到了函數(shù)的遞歸+回溯,很有意思 俺的做法: #include <stdio.h> #include <ctype.h> #include <string.h> #include <math.h> char b[1000]; char c[1000]; char d[1000]; char a[10
閱讀全文
摘要:
一道很有趣的題目,考了小車的行動,同時要設(shè)置方向號來進行偏移方向 俺的做法: #include <stdio.h> #include <ctype.h> #include <string.h> #include <math.h> int main() { int x=0,y=0; int dirto
閱讀全文
摘要:
最近兩天都沒有更新博客力( 其實是去學了些算法,算是對計算機科學有了全新的認識吧(我之前在課本學的是什么勾八玩意兒) CP1055 有多少個數(shù)的和是素數(shù)(經(jīng)典的回溯算法,暴力枚舉) 俺的做法:#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后面再調(diào)吧 #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為柿子個數(shù) int a[100];//敲
閱讀全文
摘要:
又是一道小題,(但是也不是空格作為分割符,范圍更廣)本質(zhì)上還是連續(xù)字符串,又考了判斷嵌套啊 俺的做法: #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
閱讀全文