自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(38)
  • 收藏
  • 关注

原创 Vscode配置C++遇到的问题

如果在外部黑框框必须不注释掉 否则乱码。忘了配置这两个文件了 launch.json与tasks.json。2. 这个也需要是false否则会冲突。注释的一行 如果是内部终端需要注释掉。这个需要改成g++ 否则不能用万能头。1.在内部终端需要勾掉。

2023-04-05 12:43:34 578 1

原创 vscode Java链接数据库导入jar包后出现“无法加载主类,找不到主类“

Java mysql vscode 导入包的错误

2022-06-18 17:53:16 480

原创 蚂蚁 程序设计

#include<stdio.h>#include<algorithm>#include<iostream>#include<math.h>using namespace std;int main(){ int a[100], n,L; scanf("%d%d", &n,&L); for (int i = 1; i <= n; i++) { cin >> a[i]; } int rec...

2021-12-26 13:42:36 3764

原创 计算鞍点 c语言

#include<stdio.h>int k;int max;void camp(int *point, int m, int hang, int n){ max = -1; for (int i = 0; i < m; i++) { if (*point > max) { max = *point; k = i; } point++; }}int main(){ int tian[100][100]; int n, ...

2021-12-20 12:19:58 909

原创 约瑟夫环,3改成m即可

#include<stdio.h>int main(){ int people[1000] = { 0 };//赋值为一 int n; scanf("%d", &n); int all = n;//all记录现存的人数 int u = -1, i;//u代表编号,因为首项必为第三人(编号u=2),所以此时u=-1,原因看完就懂了 while (1) {// 一些测试案例...2 2+2=1 1 //1 2 3 4 3 , 2+2=4=0 2 //1 ...

2021-12-16 17:22:27 186

原创 添加记录(结构体)(利用指针交换)

#include<stdio.h>#include<string.h>#include<stdlib.h>int u = 0;int flag = 0;typedef struct tian{ char xuehao[10000]; int chengji[4]; char name[1000];}tian;void swap(tian*ss, tian*pp){ tian t; t = *ss; *ss = *pp; *pp...

2021-12-06 21:42:07 3345

原创 安全的字符串拷贝 oj指针

#include<stdio.h>#include<string.h>int main(){ char tian[1000]; char du[1000]; scanf("%s", tian, 100); char ch = getchar(); scanf("%s", du, 100); int j = strlen(du); char zhizheng[100]; int i = strlen(tian); char* tiandu[2]; t...

2021-12-02 19:22:04 184

原创 删除字符(指针) 指针遍历 进制转换 中原工学院oj

#include<stdio.h>#include<iostream>#include<math.h>#include<string.h>using namespace std;int main(){ int n,m,tian,du; while (scanf("%d%d", &n, &m) != EOF)//7 2 7%2=1 7/2=3 3%2=1 1/2=0 1%2=1 { char num[50]...

2021-11-27 09:09:31 633 2

原创 删元素下标

#include<stdio.h>int main(){ int b[100],i,j,n,k; scanf_s("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &b[i]); } scanf_s("%d", &k); for (j = 0; j < n; j++) { if (j != k) printf("%d ", b[j]); } return 0;}

2021-11-18 19:27:07 882

原创 杨辉三角 删除字符 加密解密

//#include<stdio.h>//#include<string.h>//int main()//{// char a[100],b[100];// gets(a);// int x = strlen(a);// int m=0;// while (m < x)// {// b[m] = a[m];// //printf("%c", a[m]);// a[m]=a[m]+2;// m++;// }// puts(a);// ...

2021-11-18 18:27:02 215

原创 海选女主角

#include<stdio.h>#include<math.h>#include<time.h>int main(){ int a[100][100], m, n, l,k; while (scanf_s("%d %d", &m, &n) != EOF) { for (l = 1; l <= m; l++) { for (k = 1; k <= n; k++) { scanf_s("%d", &...

2021-11-18 11:34:49 323

原创 字符串比较

#include<stdio.h>#include<math.h>#include<string.h>int a(char c[], char p[]){ int i; if (strcmp(c, p) == 0) printf("0"); else { for ( i = 0; i <= 80; i++) { if (c[i] != p[i]) break; } p...

2021-11-17 21:38:16 336

原创 c 小猫钓鱼

#include<stdio.h>struct quene//结构体的引入{ int data[100];// int head; int tail;};struct desk//代表桌面的牌数{ int data[1000]; int top;//栈顶};int main(){ struct quene q1, q2;//结构体变量 struct desk s; int book[100];//判断结束 int t, i; q1.head = 1; q1..

2021-11-01 22:04:50 104

原创 scanf_s 输入所需字符%c的笨方法

输入 enter+1+enter 循环就结束了 数组存储的字符也就是a[1]=enter a[2]=1 a[3]=enter(回车)那么如何输入想要的字符呢?有个简单笨拙的方法#include<stdio.h>#include<string.h>int main(){ char a[101], s[101]; int u = 1,w=1,i; for (int i = 1; i <= 3; i++) { scanf_s("%c", &...

2021-10-31 00:27:21 607

原创 2021-10-31

回文数#include<stdio.h>#include<string.h>int main(){ char a[101], s[101]; int top ,mid,next,i,len; gets(a); top = 0; len = strlen(a); //printf("%d", len);//一个字符,长度为1,len++ mid = len / 2 - 1;//ahaha mid=2也就是一半的前一位 for ( i = 0; i

2021-10-31 00:07:58 94 1

原创 HDOJ 1004 Let the Balloon Rise(C语言)

图片有点小...复习二维数组知识了需要

2021-10-27 14:46:59 132

原创 利用递归计算排列组合,C语言

#include<stdio.h> int k = 0;//静态全局变量的设置,观察得当c计算结束时返回到栈底时,恰有c的计算次数正好就是k从0开始累加到c计算结束int y(r){ if (r == 1||r==0) return 1; else return r * y( r - 1);}int x(int n,int r)//主要判断函数{ int c,j; k++; if (r == 1) return n; else { c = n .

2021-10-25 20:20:08 1166 1

原创 交换数字,不创建第三个变量

#include<stdio.h>int main(){ int a=3, b=5; //加减法 a = a + b; b=a-b; a = a - b; printf("%d %d", a, b); return 0;}但是可能会溢出,利用二进制#include<stdio.h>int main(){ int a=79, b=9; //异或法 a = a^b;//011 101 110=6 b=a^b;//110 101 011=3 ..

2021-10-23 15:09:17 103 3

原创 const在函数中的使用

#include<stdio.h>#define five 6void i( const int v[],int u)//const锁定传过来的实参类型{ int i; for (i = 1; i <= u; i++) { v[i] = 0;//再次修改就会错误,去掉const就会成功 printf("%d", v[i]); }}int main(){ int a[] = { 1,2,3,4,5 }; i(a, 4); return 0;}.

2021-10-23 09:39:53 291

原创 汉诺塔问题

#include<stdio.h>int m = 0, j = 0;void p(int x, int z){ int t; t = x; x = z; z = t; m++;} void hanoi(int n, char x, char y, char z){ if (n == 1) { p( x, z); j++; } else { hanoi(n - 1, x, z, y); p(x, z); hanoi(n - 1...

2021-10-22 23:54:46 96

原创 利用函数,输入倒转数

参考书籍《明解c语言》#include<stdio.h>int scan_pint(void)//空函数,无返回值{ int t; do { printf("输入一个正整数"); scanf_s("%d", &t); } while (t <= 0);//利用do循环,来确定输入的是整数 return t;//返回调用处}int rev_int(int k)//执行函数{ int t = 0;//定义t来储存值 if (k > 0.

2021-10-21 22:21:50 103

原创 排序 先升序一半数,后一半数降序(多组数据输入)

#include<stdio.h>int main(){ int a[100000], i, j, m,n,k,u,t,l,p,q,e,v; while (scanf_s("%d", &n) != EOF)//多组输入 { for (i = 1; i <= n; i++) { scanf_s("%d", &m); a[i] = m; } for (e = 1; e < n; e++)//所有数据先升序排列,必须有...

2021-10-20 00:19:28 646

原创 优秀成绩标记

#include<stdio.h>#include<math.h>int main(){ long long str; char w; int b, c, d, e; scanf_s("%lld", &str); scanf_s("%c", &w); scanf_s("%d%d%d%d", &b, &c, &d, &e); double x; x = (b + c...

2021-10-19 18:10:22 425

原创 2021-10-18百钱百马问题

#include <stdio.h>int main(){ int m,n,x,y,z=0,count; while(scanf("%d %d",&m,&n)!=EOF) { count=0; //count每次循环都要赋初值,否则每次输入新数count的值会递加 for(x=0;x<=100;x++)//不要忘记等号 { for(y=0;y<=100;y++)//不要忘记等号 { z=(1...

2021-10-18 19:36:10 70

原创 卡片游戏 基础c语言试题

#include<stdio.h>int main(){ int n, a[7],i,m=0,k,l,w=0;\\开七个位置房间 scanf_s("%d\n", &n);//总共6个数是吧 for(i=1;i<7;i++) scanf_s("%d", &a[i]); for(k=1;k<n;k+=2)//m等于奇数的和 m = a[k]+m; for (l = 2; l <= n; l += 2)//w等于偶数的和 w =...

2021-10-13 10:32:39 1696 3

原创 兔子繁殖问题 1 简单解法

#include<stdio.h>#include<math.h>int main(){ int a[41], b, c, n,i;//因为从0开始a[0],a[1]所以需要定义41个变量的房间存下来a[40] scanf_s("%d", &n); a[1] = a[2] = 1;//在这之前我在纸上找到了兔子繁殖的规律,第五个月的总数等于第四个月加上第三个月的 for (i = 3; i <= 40; i++)\\借助for给每个小房间赋值...

2021-10-12 21:18:38 151

原创 同构数 简单基础c语言题

include<stdio.h>#include<math.h>int main(){ int n,b,c=0,j; scanf_s("%d", &n);//输入n求n以内的 while (n > 1)//n以内的就用这种循环就行了 { for (j=10;j<=10000000;j*=10)//因为用到取余数,所以j等于10的次方 { if (n==10||n==100||n==1000)//e这几个特殊的值不好搞,单独...

2021-10-12 20:08:35 412 3

原创 完全平方数 求n内的整数个数

哭晕在厕所,=+合+=弄混了,咋弄都过不去,最后才过去#include <stdio.h>int main(){ int i; int j; int k; int n; int m=0; scanf_s("%d", &n); for (i = 0; i < n; i++)//循环n以内的所有值 { for (j = 0; j < i; j++) { if (i + 100 == j * j) { for (k = 0..

2021-10-11 11:42:18 111

原创 正整数分解质因子

#include<stdio.h>int main(){ int i, n, a; scanf_s("%d", &n); for (i = 2; i <= n; i++)//进入循环 { while (n % i ==0)//写成那样的形式的话,既然是从最小开始,只要能除尽就进入循环 { printf("%d", i); n /= i;//把n变成除后的数,判断用现在的i是否还能除尽,不能就退出while if (n != 1)//因...

2021-10-11 10:04:01 62

原创 简单奥数题 c语言基础

这是啊哈c上的一道基础题,如果手动算的话还是挺麻烦的这是啊哈c的答案,但是这是指的两边变量相同的前提下,要是两边变量不同呢?#include<stdio.h>int main(){ int a, b, c, d; for (d = 0; d <= 9; d++) { for (c = 1;c <= 9; c++) { a = (c * 10 + 3) * 6528; b = (d + 30) * 8256; ...

2021-10-09 09:42:20 152

原创 时间差值 c语言

首先这题我是太垃了,第一个想法就是套if else,没想到好的方法,这是我的笨蛋方法*#include<stdio.h>#include<math.h>int main(){ int a, b, c,d,e,f,g; scanf_s("%d:%d:%d\n", &a, &b, &c); scanf_s("%d:%d:%d", &d, &e, &f); if (e - b >= 0 &&...

2021-10-06 11:51:59 568

原创 水仙花数 简单基础c语言题

#include<stdio.h>#include<math.h>int main(){ int a,n; scanf_s("%d", &n); for (a = 153; a <= n; a++) { //取百位 //取个位 //取十位,稍微麻烦一点不过可以先转化为个位...

2021-10-06 10:51:19 104

原创 %字符的输入输出

#include<stdio.h>#include<math.h>int main(){ int a, b, c; scanf_s("%d%%%d%%%d", &a, &b, &c); printf("%d%%%d%%%d", a, b, c); return 0;}%d%%后面接两个%%代表输出一个%同理输入scanf应该也加上%%代表输进去了一个%...

2021-10-05 13:34:24 881 2

原创 区别数字与英文

#include<stdio.h>#include<math.h>int main(){ char a; scanf_s("%c", &a); if (a >= 'a' && a <= 'z') printf("It is an English character.\n"); else { if (a >= '0' && a <= '9')...

2021-10-05 13:14:25 89

原创 数字三角显示 简单oj基础题

#include<stdio.h>#include<math.h>int main(){ int a,i,f,b; scanf_s("%d", &a); i = 0; f = 0; b = 1; while (a >= 1) 这一部分用来打印数字一个0 两个1 三个2.... { for (i = 0; i < b; i++) {...

2021-10-05 10:33:49 123

原创 最小公倍数,简单基础题

include<stdio.h>#include<math.h>int main(){ int a, b, d; scanf_s("%d%d", &a,&b); for (d=b;d<=(a*b);d++) { if (d % a == 0 && d % b == 0) { printf("%d", d); break; ...

2021-10-05 10:11:02 71

原创 简单基础题 数列求和(4)

#include<stdio.h>#include<math.h>int main(){ int a, b, c, d,i; scanf_s("%d", &a); d = 0; while (a >= 1) { if (a % 2 != 0) { b = a + 1; c = b + 1; d = d + a * b ...

2021-10-05 09:48:33 87

原创 简单oj题素数合

#include<stdio.h>#include<math.h>int main(){ int a, b, c, d,i; scanf_s("%d", &a); d = 0; while (a > 100) { i = 0; for (b = 2; b <= a - 1; b++) { if (a % b == 0) ...

2021-10-05 09:10:22 153

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除