#include <stdio.h>
int countNumber2(int n)
{
int f = 1, g = 2;
for (int i = 1; i < n; i++){
g += f;
f = g - f;
}
return f;
}
int main()
{
......................
阅读全部 | 2020年6月17日 12:05
#include <stdio.h>
int gys(int m, int n)
{
if (n <= 0) return m;
return gys(n, m%n);
}
int main()
{
int count, i;
int data1[20] = {};
int data2[20] = {};
......................
阅读全部 | 2020年6月17日 11:53
#include <stdio.h>
int GetPathNumber(int a, int b)
{
int f, f1, f2, i;
f = 0; f1 = 1;
for (i = a; i < b; i++){
f2 = f + f1;
f = f1;
f1 = f2;
}
return f2;
}
......................
阅读全部 | 2020年6月17日 11:26
#include <stdio.h>
int countNumber(int stepsNum)
{
if (stepsNum == 0) {
return 0;
}
if (stepsNum == 1) {
return 1;
}
else if (stepsNum == 2) {
return 2;
}
......................
阅读全部 | 2020年6月17日 11:16
#include <stdio.h>
int gys(int a, int b)
{
if (a == b) return a;
if (a > b) return gys(a - b, b);
return gys(a, b - a);
}
int main()
{
int count, i;
int data1[20] = {};
......................
阅读全部 | 2020年6月17日 11:09
#include <stdio.h>
void transpose(int mtx[3][3])
{
int t;
t = mtx[0][1]; mtx[0][1] = mtx[1][0]; mtx[1][0] = t;
t = mtx[0][2]; mtx[0][2] = mtx[2][0]; mtx[2][0] = t;
t = mtx[2][1]; mtx[2][1] = mtx[1][2]; mtx[1][2] = t;
}
int main()
{
int i;
......................
阅读全部 | 2020年6月17日 11:02
#include <stdio.h>
int isprime(int n)
{
if (n == 1) return 1;
for (int i = 2; i*i <= n; i++)
if (n%i == 0) return 0;
return n > 1;
}
void xuanxian2()
{
int n; int m;
int i, s = 0;
......................
阅读全部 | 2020年6月17日 10:55
#include <stdio.h>
void shiftLeft(char str[], int count)
{
int i;
char temp[120];
char* s1, *s2;
for (i = 0; i < count; ++i){
temp[i] = str[i];
}
s1 = str + count;
s2 = str;
while (*s2 = *s1){ ++s2; ++s1; };
......................
阅读全部 | 2020年6月17日 10:40
#include <stdio.h>
int substr(char str1[], char str2[], int index)
{
int n = 0;
char* s = str1;
while (*s++) ++n;
if (0 <= index && index < n){
s = str1 + index;
while(*str2++ = *s++);
return 1;
}
s = "IndexError";
......................
阅读全部 | 2020年6月17日 10:40
#include <stdio.h>
#include <stdlib.h>
// 坐标
typedef struct
{
int x, y;
}SPostion;
// 栈中数据
typedef struct
{
......................
阅读全部 | 2020年6月16日 14:36