## C语言之练手题

news/2024/4/24 13:41:35/文章来源:https://blog.csdn.net/2301_77900444/article/details/136572027

``````#include <stdio.h>void Num_round(int arr[], int sz)
{int left = 0;int right = sz - 1;while (left < right){//1.left指向为奇数，往前走，遇到偶数停下来while (left < right && arr[left] % 2 != 0){left++;}//2..right指向为偶数，往后走，遇到奇数停下来while (left < right && arr[right] % 2 == 0){right--;;}//3.停下来后两者进行交换int tmp = arr[left];arr[left] = arr[right];arr[right] = tmp;}
}int main()
{int arr[] = { 1,2,3,4,5,6,7 };int sz = sizeof(arr) / sizeof(arr[0]);Num_round(arr, sz);for (int i = 0; i < sz; i++){printf("%d ", arr[i]);}return 0;
}
``````

``````#include <stdio.h>int main()
{int money = 0;scanf("%d", &money);int empty = money;int total = money;while (empty > 1){total = total + empty / 2;empty = empty / 2 + empty % 2;}printf("%d\n", total);return 0;
}
``````

``````#include <stdio.h>int main()
{int a = 0;scanf("%d", &a);int sum = 0;int tmp = 0;for (int i = 0; i < 5; i++){tmp = tmp * 10 + a;sum += tmp;}printf("%d\n", sum);return 0;
}
``````

``````#include <stdio.h>void Func(int n)
{//偶数位for (int i = 31; i >= 1; i-=2){printf("%d ", (n >> i) & 1);}printf("\n");//奇数位for (int i = 30; i >= 0; i -= 2){printf("%d ", (n >> i) & 1);}
}int main()
{int n = 0;scanf("%d", &n);Func(n);return 0;
}
``````

### WPF Border控件 基本使用

Border 基本使用 1单线效果 代码&#xff1a; <Border Grid.Row"0" BorderThickness"0,0,0,1" BorderBrush"Red" /> 说明&#xff1a; BorderThickness"0,0,0,1" 可以分别设置四条边&#xff0c;顺序是&#xff1a;左 上 右…

### ArmSoM Rockchip系列产品 通用教程 之 UART 使用

1. UART 简介​ Rockchip UART (Universal Asynchronous Receiver/Transmitter) 基于16550A串口标准&#xff0c;完整模块支持以下功能&#xff1a; 支持5、6、7、8 bits数据位。支持1、1.5、2 bits停止位。支持奇校验和偶校验&#xff0c;不支持mark校验和space校验。支持接…

### 【论文阅读】High-Resolution Image Synthesis with Latent Diffusion Model

High-Resolution Image Synthesis with Latent Diffusion Model 引用&#xff1a; Rombach R, Blattmann A, Lorenz D, et al. High-resolution image synthesis with latent diffusion models[C]//Proceedings of the IEEE/CVF conference on computer vision and pattern re…

### Spring Boot中Excel数据导入导出的高效实现

&#x1f31f; 前言 欢迎来到我的技术小宇宙&#xff01;&#x1f30c; 这里不仅是我记录技术点滴的后花园&#xff0c;也是我分享学习心得和项目经验的乐园。&#x1f4da; 无论你是技术小白还是资深大牛&#xff0c;这里总有一些内容能触动你的好奇心。&#x1f50d; &#x…