欢迎指正,多谢关注。看到用全中文编写即表示很认真。
数据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("输入姓名:");
...