![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
杭电OJ
嵌入式Linux系统开发
博主就职于芯片原厂,熟悉硬件、STM32单片机、嵌入式 Linux、Android。
展开
-
求矩阵主对角线元素及副对角线元素之和
#include<stdio.h>int main(){ int i,j; int a[3][3]; int s = 0,t = 0; for(i = 0;i < 3;i++) { for(j = 0;j < 3;j++) { scanf("%d",&a[i][j]); } } for(i = 0;i < 3;i++) s += a[i][i]; for(i = 0;i < 3;i++) t += a原创 2020-07-17 12:20:39 · 5033 阅读 · 0 评论 -
快速排序(原理+程序)
#include <stdio.h> int a[101],n;//定义全局变量,这两个变量需要在子函数中使用void quicksort(int left,int right) { int i,j,t,temp; if(left>right) return; temp=a[left]; //temp中存的就是基准数 i=lef...原创 2019-10-25 15:19:43 · 160 阅读 · 0 评论 -
冒泡排序(原理+程序)
#include <stdio.h> int main() { int a[100],i,j,t,n; scanf("%d",&n); //输入一个数n,表示接下来有n个数 for(i=1;i<=n;i++) //循环读入n个数到数组a中 scanf("%d",&a[i]); //冒泡排序的核心部分 for(i=1;i&l...原创 2019-10-25 14:40:41 · 240 阅读 · 0 评论 -
桶排序(原理+程序)
代码:#include <stdio.h> int main() { int a[11]={0},i,j,t; for(i=1;i<=5;i++) //循环读入5个数 { scanf("%d",&t); //把每一个数读到变量t中 a[t]++; //桶排序,进行计数 } for(i=0;i<=10;i++) //依...原创 2019-10-25 10:54:45 · 311 阅读 · 0 评论 -
C语言:测试输入值是否为数字或字母的isalpha函数和isdigit函数(isspace、ispunct等等)
isalpha函数:isalpha 原型:int isalpha(int ch) 用法:头文件加入#include (旧版本的编译器使用<ctype.h>) 功能:判断字符ch是否为英文字母,当ch为英文字母a-z或A-Z时,在标准c中相当于使用“isupper(ch)||islower(ch)”做测试,返回非零值(不一定是1),否则返回零。isdigit原型:e...原创 2019-10-23 10:12:12 · 715 阅读 · 0 评论 -
HDOJ之2012——2021
2012#include<stdio.h>#include<math.h>int main() { int x, y; while(scanf("%d%d", &x,&y)!=EOF && (x || y)) { int flag = 1; for(int i = x; i <= y; i++) { in...原创 2019-10-25 11:00:46 · 177 阅读 · 0 评论 -
杭电OJ之1720、1062、2104、1064、2734、1170、1197、2629
1720#include<stdio.h>int main(){ int a,b; while(scanf("%x%x",&a,&b)!=EOF) { int sum=a+b; printf("%d\n",sum); } return 0;}1062#include<std...原创 2019-10-14 22:31:18 · 315 阅读 · 0 评论 -
ACM中AC、WA、PE、RE分别是什么意思
英文原版(下面有翻译)Queuing: The judge is so busy that it can't judge your solution at the moment. Usually you just need to wait a while because our judge server is powered by IBM and Intel Xeon :-)Compilin...原创 2019-10-12 00:27:38 · 23758 阅读 · 3 评论 -
杭电OJ(HDOJ)水题之2000——2011、2039
2000#include <stdio.h> int main() { char a,b,c,d,x,y,z; while(scanf("%c%c%c%c",&a,&b,&c,&d) != EOF) { x=a<b?a:b; x=x<c?x:c; z=a&g...原创 2019-10-12 00:12:15 · 263 阅读 · 0 评论 -
杭电OJ(HDOJ)入门题目列表
第一阶段:开始入门吧!(15天,53题)一.输入输出练习(2天,10题)1000、1089—1096、1001二.简单操作:(2—4天,12题)2000—2011、2039三.试水(3—4天,8题)1720、1062、2104、1064、2734、1170、1197、2629四.回归水题(4-6天,24题)2012—2030、2032、2040、2042、2054、2055第二阶...原创 2019-10-10 08:53:59 · 6221 阅读 · 0 评论 -
杭电OJ(HDOJ)之1000——1002、1089——1096
1000#include <stdio.h>int main(){ int a,b; while(~scanf("%d %d",&a,&b)) //多次输入a和b。等效于 while(scanf("%d %d",&a,&b)!=EOF) { printf("%d\n",a+b); }}...原创 2019-10-08 18:41:53 · 208 阅读 · 0 评论