21年11月19日周结 c语言和python

【华为OD】2024年华为OD机试C卷、D卷真题集:最新的真题集题库 C/C++/Java/python/JavaScript 2024年华为OD机试C卷真题题集题库,有2种分数的题目列表分别是100分的列表、200分的列表从2023年11月开始,华为OD题目切换到C卷,基本上大概率会使用半年左右,要在2024年5月之前把这些题目都好好练习一下,可以得到很好的收获,基本上都是出的原题,提前恭喜大家都上岸。目前通过大大提供的真题练习,已经有上百人成功上岸了,而且大大还是一个老师,通过大大指导进入华为OD的学生已经有上千人了。 2024年5月之前,碰到原题的概率是98%以上。 阅读详情

终于回来了,连轴转了好几天好几天,终于忙完活动和上课内容,闲下来整理下最近的语言,下周依然是数不清的考试·······
c语言推进到定义函数和函数的调用
python学的比较浅,过了切片,也来到了函数

切记赋值时,要赋值的放于等号左边,内容放右边

两个定义:
传值调用:
函数的形参和实参分别占有不同的内存块,对形参的修改不会影响实参
传址调用:
*传址调用是把函数外部创建变量的内存地址传递给西数参数的一种调用西数的方式。
*这种传参方式可以让西数和西数外边的变量建立起正真的联系,也就是西数内部可以直接操
作函数外部的变量。

选择排序和冒泡排序  c语言和python两类:

//选择排序 
#include <stdio.h>
void selectSort(int a[],int len)
{
	int i,j,temp,k;
	for (i = 0;i < len-1;i++){
		k = i;
		for(j = i+1;j < len;j++)
		{
				if (a[k] > a[j]){
					temp = a[k];
					a[k] = a[j];
					a[j] = temp; }
		}
	}
}
int main()
{
	int A[]={64,25,12,22,11,7,9};
	int n = sizeof(A) / sizeof(int);
	selectSort(A,n);
	printf("排序后结果为:");
	for (int i =0;i< n;i++)
	{
		printf("%d ",A[i]);
	}
	return 0;
}
//冒泡排序	 
#include <stdio.h>
void bubbleSort(int a[],int len)
{
	int i,j,temp; 
	for (i = 0;i < len-1;i++)
	{
		for (j = 0;j < len-i-1;j++)//保持 len-i-1 与 j+1相对应,因为排序时舍去了最大和最小值
			{
				if (a[j] > a[j+1]){
					temp = a[j];
					a[j] = a[j+1];
					a[j+1] = temp; }
			 } 
	}
}
int main()
{
	int A[]={64,25,12,22,11,7,9};
	int n = sizeof(A) / sizeof(int);
	bubbleSort(A,n);
	printf("排序后结果为:");
	for (int i =0;i< n;i++)
	{
		printf("%d ",A[i]);
	}
	return 0;
}

python之中仅需要::
 

//选择排序:
def selectSort(a):
    n = len(a)
    for i in range(n):
        k = i
        for j in range(i+1,n):
            if a[k]>a[j]:
                k = j
        a[i],a[k] = a[k],a[i]
A = [64,25,12,22,11,7,9]
selectSort(A)
print('排序后的结果:')
for i in range(len(A)):
    print('%d'%A[i])
//冒泡排序
def bubbleSort(a):
    n = len(a)
    for i in range(n):
        for j in range(0,n-i-1):
            if a[j] > a[j+1]:
                a[j],a[j+1] = a[j+1],a[j]
A = [64,25,12,22,11,7,9]
bubbleSort(A)
print('排序后的结果:')
for i in range (len(A)):
    print ('%d'%A[i])

另外分享一道恶心人的python题目:

 

def fac(x):
    f = 1
    for i in range(1,x+1):
        f = f*i
    return f
def mycos(x, n=10):
    s = 0
    for i in range(n+1):
        s = s + (-1)**i*x**(2*i)/fac(2*i)
    return s
pi = 3.14159
x  = pi/3
for n in range(5):
    print('n=%d时,cos(60°)=%.5f' % (n, mycos(x, n)))
print('-'*30)
L = [0, 30, 45, 60, 90]
for x in L:
    print('cos(%d°)=%.5f' % (x, mycos(x*pi/180)))

输出结果:

 这周我赶紧搞下递归,讲之前的辗转相除法用递归写下
有问题请指正!

【脚本语言】玩转Python(一):从历史中认识Python Python由吉多·范罗苏姆创造,第一版发布于1991年,它是ABC语言的后继者,也可以视之为一种使用传统中缀表达式的LISP方言。 阅读详情

相关推荐

【华为OD】2024年C、D卷真题集:最新的真题集题库 C/C++/Java/python/JavaScript

华为OD真题,2024年C卷真题题集,有2种分数的题目列表,分别是100分的列表、200分的列表

十年以上编程经验的干货分享 4925

2017年11月编程语言排行榜:Java持续下滑仍稳居第1,Python逆袭C#上升到第4

程序猿(微信号:imkuqin) 猿妹 编译 TIOBE编程语言社区发布了 2017 年 11 月排行榜,Java、C、C ++ 三门编程语言依然占据前三。本月前 5 排名中,最值得注意的是: Python 再次逆袭,已经超越C#,上升到第 4 的位置。 年初,Swift 曾一度进入前十名,近期,Swift 却不断下滑,本月从上个月的第 16 名掉到了如今的历史最低第 20

程序猿 4012

【Unity】制作简易三维场景

本文介绍如何制作一个三维场景

CiNian_的博客 5332

【华为OD】2024年机试C卷、D卷真题集:最新的真题集题库 C/C++/Java/python/JavaScript

2024年C卷真题题集题库,有2种分数的题目列表,分别是100分的列表、200分的列表 从2023年11月开始,华为OD题目切换到C卷,基本上大概率会使用半年左右,要在2024年5月之前把这些题目都好好练习一下,可以得到很好的收获,基本上都是出的原题,提前恭喜大家都上岸。目前通过大大提供的真题练习,已经有上百人成功上岸了,而且大大还是一个老师,通过大大指导进入华为OD的学生已经有上千人了。 2024年5月之前,碰到原题的概率是98%以上。

十年以上编程经验的干货分享 2765

新手如何学习车载底层嵌入式软件开发(AutoSar)

汽车嵌入式开发

ACarSoft的博客 4219

VIO实战前传:手把手教你解读Kalibr双目IMU标定报告与参数应用

本文详细解析Kalibr双目IMU联合标定报告的核心参数与应用方法,涵盖重投影误差分析、IMU误差指标解读、关键变换矩阵原理及VINS-Fusion实战配置。通过手把手教学帮助开发者准确理解标定结果,解决VIO算法落地中的参数配置难题,提升视觉惯性里程计的系统稳定性与精度。

weixin_42699679的博客 331

2021TIOBE 11月榜单:Python蝉联榜首,PHP前十“岌岌可危”

2021 年 11月的TIOBE编程语言排行榜出炉!

shunshunss的博客 1264

69页完整版智慧港口综合解决方案

智慧港口需求4港机远程操控等自动化改造需求自动化码头AGV无线通信及专用视频系统需求安全生产视频监控类需求港机RCMS及设备管理需求岸边智能理货码头三维全景应用智慧港口解决方案5自动化码头AGV/跨运车/无人集卡无线接入港机远控视觉及冗余无线通信视觉集卡防吊起系统集装箱码头岸边智能理货港机RCMS系统无线接入港机智能化管理(无线高清视频监控、一键报警、远程抄表系统)港口拖轮无线接入岸边溢油监测系统TD-LTE覆盖及业务终端接入港口生产管理系统港口可视化集群调度港口GiNMS综合网络设备智能管理全球作业效率最

zuoan1993的博客 2128

2022年11月编程语言流行度排名

2022年11月编程语言流行度排名 编程语言流行度排名是通过分析在谷歌上搜索语言教程的频率而创建的 一门语言教程被搜索的次数越多,大家就会认为该语言越受欢迎。这是一个领先指标。原始数据来自谷歌Trends 如果您相信集体智慧,那么流行编程语言排名可以帮助您决定学习哪门语言,或者在一个新的软件项目中使用哪一门语言

AI的博客 875

【华为OD机试真题】45、 分糖果 | 机试真题+思路参考+代码解析(C++、Java、Py、JS)

### 🎃题目描述 >小明从糖果盒中随意抓一把糖果,每次小明会取出一半的糖果分给同学们。 >  当糖果不能平均分配时,小明可以选择从糖果盒中(假设盒中糖果足够)取出一个糖果或放回一个糖果。 >  小明最少需要多少次(取出、放回和平均分配均记一次),能将手中糖果分至只剩一颗。

正在更新最新华为OD机试2025B卷,提供OJ在线刷题 1290

Zephyr内核——内存管理——内存堆

Zephyr提供了一组允许线程动态分配内存。

wayne2018的博客-心情驿站 771

python现在排第几_2019编程语言排行榜,Python排名第三

2019编程语言排行榜,Python排名第三来源:本站 作者:admin 日期:2019/11/25 10:15:57 浏览次数:1457TIOBE已经公布了编程语言排行榜2019年11月的数据,编程语言11月的排名有了新的变化,C非常接近Java,指数仅差0.2%,Python继续占领第三名,C++本月下降2.68%。下面一起来看看2019年11月编程语言排行榜。2019年11月编程语言排行榜看...

weixin_39569076的博客 375

L型探测器几何畸变矫正

定位像素空间位置 -> 计算水平面投影点 -> 统一物理分辨率 -> 重采样生成新图。

如果想成为中心,那么就到中心去吧。 241

TIOBE 11月指数:C语言稳居宝座,Python反超!

官方网址:https://www.tiobe.com/tiobe-index/ ​ 这是自近20年前TIOBE指数开始以来,Java和C第一次不再占据前两位。C仍然是第一位的,但是现在第二个位置是Python。 有人说Python最近流行的原因是数据挖掘、人工智能和数值计算等蓬勃发展的领域。但TIOBE对此有自己的看法。 TIOBE认为Python的流行与一般需求有关。 过去,大多数编程活动都是由软件工程师完成的。但是现在到处都需要编程技能,而且缺乏优秀的软件开发人员。因...

miaozenn的博客 260

Chrome DevTools MCP 实战完整教程

本教程介绍了Chrome DevTools MCP(Model Context Protocol)在智能Web测试中的应用。该系统通过MCP协议将Chrome开发者工具能力标准化,并与AI结合,提供了统一的测试解决方案。核心功能包括智能自动化、深度调试分析和性能监控优化。教程详细讲解了环境搭建、MCP服务器配置、参数说明及多种工具集(输入自动化、导航、设备仿真、性能分析等)的使用方法。通过mcp-use库的MCPAgent和MCPClient组件,用户可以轻松实现自然语言驱动的浏览器操作和测试流程管理。

blues_C的博客 3803

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

TIOBE 11月编程语言排行:Java首次跌出前二,Python 势不可挡。

整理 | 郑丽媛头图 | 优快云下载自视觉中国出品 | 优快云(ID:优快云news)编程语言社区 TIOBE 最新发布了 11 月编程语言排行榜。本月的排行榜出现了自 TIOBE...

张巧龙的博客 628

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

2023年11月编程语言流行度排名

如果您相信集体智慧,那么流行编程语言排名可以帮助您决定学习哪门语言,或者在一个新的软件项目中使用哪一门语言。一门语言教程被搜索的次数越多,大家就会认为该语言越受欢迎。原始数据来自谷歌Trends。

AI的博客 835

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

全球软件开发语言排行榜 2008年11月

 黑马PowerShell被踢出榜单,取代他的是另一个解析类语言ActionScript,Delphi重整旗鼓,C#仍然不温不火……PositionNov 2008PositionNov 2007Delta in PositionProgramming LanguageRatingsNov 2008Delta Nov 2007Status11

Kimi - 要【博】就搏精彩,是【客】就写原创。 823

TIOBE 11月榜单:Python挤掉了Java!

点击上方 "程序员小乐"关注,星标或置顶一起成长后台回复“大礼包”有惊喜礼包!关注订阅号「程序员小乐」,收看更多精彩内容每日英文Crouch down, hold y...

程序员小乐 819

【持续更新】华为 OD 机试 C卷抽中题库清单(全真题库)含考点说明以及在线OJ

2023年11月份,华为官方已经将 华为OD机考:OD统一考试(A卷 / B卷)切换到 OD统一考试(C卷)和 OD统一考试(D卷)。目前在考C卷,经过两个月的收集整理,C卷真题已基本整理完毕抽到原题的概率为2/3到3/3,也就是最少抽到两道原题。请注意:大家刷完C卷真题,最好要把B卷的真题刷一下,因为C卷的部分真题来自B卷。另外订阅专栏还可以联系笔者开通在线OJ进行刷题,提高刷题效率。

m0_72565653的博客 4320

2019年12月中国编程语言排行榜

2019年12月中国编程语言排行榜 ...

Xyp9x的博客 383

2020年11月编程语言排行榜:Java再掉一位排名,真的要跌落神坛了吗?

TIOBE 已公布 2020 年 10 月的编程语言排行榜。 自20年前TIOBE指数开始以来,Java和C首次不再占据前两位。 C仍然是第一,但现在是Python占据了第二的位置。有人说,Python最近的流行是由于数据挖掘、人工智能和数值计算等领域的蓬勃发展,但我有自己的看法。 我相信Python的流行与一般需求有关。在过去,大多数编程活动都是由软件工程师完成的,但是现在到处都需要编程技能,而且缺乏优秀的软件开发人员。 因此,我们需要一些非软件工程师可以处理的简单的东西,一些容易学习的东西,.

HUYA69的博客 1104
上一篇: 11月5号区区周结
下一篇: python递归以及c语言递归实现求最大公约数(补充上文)
ZZRBlogger
博客等级 码龄5年 10粉丝 8原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值