- 博客(20)
- 收藏
- 关注
原创 算术移位的补位
正数三码合一,有效位是1,无效位是0。无论左右移动都是补0。负数反码,低到高位的第一个1为界,左边取反,右边与原码相同。核心是保证在无溢出时,满足移位与乘除法的对应关系。负数的原码有效位依旧为1,两边无效位为0。负数的反码,与原码相反,故移动补1。对反码操作等价于对原码操作。原码1000 1000。反码1111 0111。补码1111 1000。
2024-07-03 15:03:43
195
原创 2141-数据结构实验之图论一:基于邻接矩阵的广度优先搜索遍历 SDUT C语言
visited[]理解为判断是否输出过更简单。#include <stdio.h>#include <stdlib.h>int map[101][101];int visited[101];int flag;void BFS(int t , int k){ if(!flag){ printf("%d",t); flag=1; } else printf(" %d",t); visited[t]=1; i.
2020-12-03 20:42:11
201
原创 -顺序表应用 多余元素删除 SDUT JAVA
#include <stdio.h>#include <stdlib.h>int i,j ;struct Seqlist{ int *arr; int size; int capacity;};void CreatSeqlist(struct Seqlist *list, int capacity){ list->arr = (int*)malloc(sizeof(int) * capacity); list->..
2020-10-22 20:33:43
178
2
原创 3482-A - A+B Problem JAVA 类 SDUT
import java.util.Scanner;class CC { int a , b ; public int c() { return (a + b); }}public class Main { public static void main(String[] args) { Scanner reader = new Scanner(System.in); int a, b; CC cc = new CC(); a = reader.nextInt();.
2020-09-25 15:44:13
212
原创 3328-JAVA判断合法标识符 SDUT JAVA
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner reader = new Scanner(System.in); while(reader.hasNext()) { //依次:定义字符串,获取首字符,获取字符串长度,定义临时字符为以便循环时读取,定义一个标志 String str = reader.nextLine(); char ..
2020-09-20 18:47:35
627
原创 SDUT 实训 超市库存管理系统 C语言
#include <stdio.h>#include <stdlib.h>#define _CRT_SECURE_NO_WARNINGSstruct Goods{ int code; char name[20]; char origin[20]; int count; double price;};char chose;void menu();void setcolor();void addGoods();void lis
2020-07-11 17:22:51
1672
1
原创 2874-师--链表的结点插入 SDUT C语言
#include <stdio.h>#include <stdlib.h>struct node{ int data; struct node*next;};int main(){ int n,count,m,x,i,j; struct node *head,*tail,*p,*q; while(~scanf("%d",&n)) { count=0; head=(struct nod.
2020-06-16 11:34:01
469
1
原创 2116-数据结构实验之链表一:顺序建立链表 SDUT C语言
注:最后输出的数据后有空格#include <stdio.h>#include <stdlib.h>struct node{ int data; struct node *next;};int main(){ int n,i; scanf("%d",&n); struct node *head,*p,*tail; head=(struct node*)malloc(sizeof(struct node)); .
2020-06-03 15:51:26
259
原创 2117-数据结构实验之链表二:逆序建立链表 SDUT C语言
#include <stdio.h>#include <stdlib.h>struct node{ int data; struct node *next;};int main(){ int n,i; scanf("%d",&n); struct node *head,*p; head=(struct node*)malloc(sizeof(struct node)); head->next=NULL.
2020-06-03 15:17:24
337
原创 1959-简单枚举类型——植物与颜色 SDUT C语言
#include <stdio.h>#include <stdlib.h>enum plant{ red, orange, yellow, green, blue, violet};int main(){ char s[100]; while(~scanf("%s",s)) { if(strcmp(s,"blue")==0)printf("Bluebells are blue.\n"); else if(..
2020-06-02 15:46:59
1240
1
原创 1960-共用体练习 SDUT C语言
在这里插入代码片#include <stdio.h>#include <stdlib.h>union test{ int a; double b; char c[30]; } test[100001];int main(){ int n,m,i,pp; char pre[100001][100]; scanf("%d%d",&n,&m); for(i=0; i<n; i++) {..
2020-06-02 15:45:33
311
原创 2873-老--质价比 SDUT C语言
#include <stdio.h>#include <stdlib.h>struct project{ int price,mass;} p[100],T;int main(){ int n,i,j; while(~scanf("%d",&n)) { for(i=0; i<n; i++) scanf("%d",&p[i].mass); for(i=0; i&l.
2020-06-02 15:43:36
527
原创 1569-选夫婿1 SDUT C语言
#include <stdio.h>#include <stdlib.h>struct man{ char name[20]; int hight,weight;} boy[ 1001],reboy[1001],T;int main(){ int count,i,N,j,a,b,c,d; count=0; scanf("%d",&N); for(i=0; i<N; i++) { s...
2020-06-02 15:41:42
525
原创 2446-最终排名 SDUT C语言
#include <stdio.h>#include <stdlib.h>struct tea{ int id,pro;} T, team[10000];int main(){ int t,N,j,i; scanf("%d",&t); while(t--) { scanf("%d",&N); for(i=0; i<N; i++) { sc.
2020-06-02 15:38:18
1313
1
原创 2741-小鑫の日常系列故事(十)——排名次 SDUT C语言
#include <stdio.h>#include <stdlib.h>struct person{ char name[11]; int score;} person[51],T; int main(){ int i,j,n; scanf("%d",&n); for(i=1; i<=n; i++) { scanf("%s %d",person[i].name,&person[i..
2020-06-02 15:35:15
872
原创 4199-小 I 选宾馆 SDUT C语言
#include <stdio.h>#include <stdlib.h>struct hotel{ int price,com,rank;} hotel[5000];int main(){ int i,n,max,ma,mcom; for(i=1; i<=5000; i++) { hotel[i].rank=i; } while(~scanf("%d",&n)) { .
2020-05-27 15:48:10
672
原创 1294-选票统计 SDUT C语言
#include <stdio.h>#include <stdlib.h>struct man{ int rank; int score;}person[1000];int main(){ int i,max,ma,m,n,p; for(i=1;i<=1000;i++) { person[i].rank=i; person[i].score=0; } scanf("%d%d",.
2020-05-27 15:40:04
490
原创 4202-小 I 的小姐姐 SDUT C语言
#include <stdio.h>#include <stdlib.h>struct girl{ int w1,w2,w3,s,rank;} girl[5005];int main(){ int i,n,max,ma; for(i=0; i<5005; i++) { girl[i].rank=i; girl[i].w1=girl[i].w2=girl[i].w3=0; } while(.
2020-05-26 17:11:31
516
原创 2551-检查宿舍卫生 SDUT C语言
#include <stdio.h>#include <stdlib.h>struct room{ int score; int rank;} room[100]; int main(){ int count,T,max,i,a,b,c,d,e; //首先需要对结构体各变量中的数据进行初始化 for(i=1; i<=100; i++) { room[i].score=0; room[i.
2020-05-26 15:39:10
745
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人