好吧,最少为了有人想学我,那我就发博文,让想学的人参考,或可学点。不知道如何带人,那就从这样开始吧。
void 字符串的删除与排序()
{//缘由https://bbs.bccn.net/viewthread.php?tid=501236&pid=2727408&page=1#pid2727408
cin >> noskipws; char a, b; cin >> b; string aa = "";
while (cin >> a)if (a == '@')break; else if (a != b)
((a + 4 - 4 + 7 ...
void 拆解整数对号入座重组(int& 数, bool 选 = true)
{
int 对号[10]{}, j = 选 ? 9 : 0, 反 = 0, 基 = 1;
while (数)++对号[数 % 10], 数 /= 10;
if (选)while (j >= 0)if (对号[j])数 *= 10, 数 += j, (反 ? 基 *= 10 : 0), 反 += 基 * j, --对号[j]; else --j;
else while (j < 10)if (对号[j])数 *= 10, 数 += j, --对号[j]; else ++j;
//j ...
欢迎指正,多谢关注。看到用全中文编写即表示很认真。
数据1-10,10-1.
已无瑕疵。
有心栽花花也开,无心插柳柳成荫,这个可用于分治排序,速度一定会提高.
void 升降分段(int* sz, int l)
{//缘由https://bbs.bccn.net/viewthread.php?tid=499776&pid=2721823&page=1#pid2721823
int j = 1, z = 0; bool k = sz[0] >= sz[1], k1 = true;
while (++j < l)
{
k1 = sz[j] >= sz[j + 1];
if ((!k && !k1) || (k ...
缘由https://bbs.bccn.net/redirect.php?tid=499753&goto=lastpost#lastpost
void 数的n次方(int a, int aa)
{
int aaa = a, c = aa;
while (--c)aaa *= a;
printf("%2d 的 %2d 次方 %2d\n", a, aa, aaa);
}
int main()
{
数的n次方(3, 2); //得到iSum的平方
数的n次方(3, 3); //得到i...
void 复制指定位置字符串(string a = "https://bbs.bccn.net/viewthread.php?tid=499735&extra=&page=1", int n = 47)
{
string aa = ""; cout << a << ends << n << endl;
if (n && n % strlen(a.data()))cout << (aa = a.substr(n - 1)) << ends << strlen(a.data()) << endl;
}
复制指...
void 输出移位字符(char* a, int aa)
{//缘由https://bbs.bccn.net/viewthread.php?tid=499719&page=1&extra=#pid2721408
char i = 97, c = 0; int j = 0;// cin >> j;
while (a[j]!='\0')
{
c = a[j]-'\0';
c = (c + (aa %= 26)) % 123;
c += c < i ? i : 0;
cout << c << ends;
a...
void 最好吃月饼()
{
int aa[100][1000]{{ 1001, 992, 0, 233, 6 }, { 8, 0, 2018, 0, 2008 }, { 36, 18, 0, 1024, 4 }},
he = 0, da = 0, x = 3, y = 5, j = 0, jj = 0;
bool k = false;
//cin >> x >> y;
//while (x > jj)if (y > j)cin >> aa[jj][j++]; else j = 0, ++jj;
while (y > jj)if (x > j...
void 组个最小值()
{//缘由https://bbs.bccn.net/viewthread.php?tid=499717&page=1&extra=#pid2721379
int j = 0, a[10]{2, 2, 0, 0, 0, 3, 0, 0, 1, 0};
if (a[0])
{
while (++j)if (a[j])break;
cout << j << ends, a[j]--;
}
j = 0; while (j < 10)if (a[j])cout << j << ends, a[j...
//缘由https://bbs.bccn.net/viewthread.php?tid=498781&page=1#pid2717311
今得闲,就来分析一下,用你的已知推算,推算不用想得很远令人畏难,只在7天之内推算,比如已知2019-10-1为周二,那么,往后推7天即2019-10-8,2个日期相差7天,用7求余为0,这天还是周二,因此要在求余加上已知周几即得正确答案,那比如往后推4天即2019-10-5,2个日期差4用7求余为4再加已知2即得周六也正确,那往后推6天怎样?用7求余为6再加2=8再用7求余为1即得周一才正确,综上所述,即日期往后推应加上已知周...
char c1[11]{};//缘由https://bbs.bccn.net/redirect.php?tid=499626&goto=lastpost#lastpost
int j = 0, t = 4;
printf("输入位数、字符串:");
scanf_s("%d", &t);
while (scanf_s("%c", &c1[j]))if (c1[j] == '\n')break; else c1[j] = ((c1[j++] - '0') + t) + '0';
j = 1; while ((c1[j]...
数花生?一堆花生2个数余1,3个数余2,5个数余4,6个数余5,7个数刚好,求三位数。
int a=111;
while(a<=999)if(a%2==1&&a%3==2&&a%5==4&&a%6==5&&a%7==0)cout<<a++<<ends;else ++a;
void 蛇形矩阵(bool 正 = true)
{//缘由https://bbs.bccn.net/viewthread.php?tid=499489&page=1&extra=#pid2720322
int n, x, y;
cin >> n;
x = y = n / 2;
int a[50][50]{{ 0 }};
int num = 1, 上左 = x - 1, 下右 = x + 1, 向 = 1;
a[x][y] = num;
while (num<n*n)
{
if (向)
{
if (正...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;/*命名空间提供简化编写并发和异步代码的工作的类型。*/
using System.Windows.Forms;
using System.IO;
...
int[] shuzu = new int[111];
string xinm = "";//缘由https://ask.csdn.net/questions/1056757
Console.Write("输入人员数量:");
int lian = int.Parse(Console.ReadLine()), j = 0;
while (lian > j)
{
Console.Write("输入姓名:");
...
分段多位数乘法4千乘以4千与4千乘以8位的原则是一样的,从左到右相乘,最高位相乘后,往后位的进位与前位相加。不想再设计了,这里只做描述和一个8位相乘的代码例子记录,估计的虽说堪舆傅里叶变换快速乘法媲美,还是觉得稍逊一点。同样的道理可用加法、减法、除法,其重点就是对进位用加法进行处理,而一次可以处理多位,受数据类型位数的限制,只能取其位数的一半-1位作为乘法,加法、减法、除法则可达18位推理的位数。
从低位往高位算也是一样的原则,(有一点区别就是要让进位暂存,等运算完成后再用加法计算进位。)从程序写作来说,从高位往低位进行运算写程序比较方便。
说白了就是传统的算法把多位数当作1位...
void 水仙十全十美()
{
long long 数 = 153, 和 = 0, 幕 = 数, 借 = 数, 方 = 1;
while (数 <= 18000000000000000000)
{ //缘由https://bbs.bccn.net/thread-499381-1-1.html
if (幕)
方 *= 借 % 10, 幕 /= 10;
else if (借)
幕 = 数, 和 += 方, 方 = 1, 借 /= 10;
else if (和 == 数)
cout << 和 << ends, ...
int aaa = 0, aaaa = 0, a = 111, aa = a, jc = a; string zc = "";
while (a < 999)
{ //缘由https://bbs.bccn.net/thread-499358-1-1.html
if (aa)aaa = aa % 10, aaaa += aaa*aaa*aaa, aa /= 10;
else
if (jc == aaaa || zc.find(to_string(aaaa)) != string::npos)
cout << a << "固定=>" << j...
Sub 狐狸找兔子(ByVal 数组() As Integer, Optional ByVal 找位 As Integer = 0, Optional ByVal 序位 As Integer = 1)
Dim 选 = ""
Do
找位 = 找位 Mod 10
Console.WriteLine(数组(找位))
Console.WriteLine(序位.ToString("间隔0"))
If 选.Contains(数组(找位)...
Sub 递归逆向(ByVal 数 As Integer)
Console.Write(数 Mod 10)
数 = 数 - (数 Mod 10)
数 = 数 / 10
If 数 > 0 Then
递归逆向(数)
Else
Console.WriteLine()
End If
End Sub