当前位置: 首页 > news >正文

新春快乐(烟花、春联)【附源码】

新春快乐

  • 一: `C语言` -- 烟花
  • 二:`Python` -- 春联
  • 三:`Python` -- 烟花
  • 四:`HTML` -- 烟花

一: C语言 – 烟花

运行效果:
在这里插入图片描述
在这里插入图片描述

#include <graphics.h>
#include <math.h>
#include <time.h>
#include <stdio.h>#define MAXNUM 15
#define WIDTH 640
#define HEIGHT 480
#define PI 3.1415926struct Fire
{int nowx;int nowy;int endy;int radio;int explode;int rgb[3];COLORREF color;
}fire[MAXNUM];void Init()
{for (int i = 0; i < MAXNUM; i++){fire[i].nowx = rand() % WIDTH;fire[i].nowy = HEIGHT + rand() % 250 + 50;fire[i].endy = rand() % 100 + 10;fire[i].radio = rand() % 50 + 120;fire[i].explode = 0;int c[][3] = { {255, 0, 0}, {210, 190, 255}, {255, 120, 0}, {255, 0, 150}, {255, 240, 100}, {10, 255, 255}, {160, 10, 255}, {255, 200, 60} };int n = rand() % 8;fire[i].color = RGB(c[n][0], c[n][1], c[n][2]);fire[i].rgb[0] = c[n][0];fire[i].rgb[1] = c[n][1];fire[i].rgb[2] = c[n][2];}
}void Draw()
{for (int i = 0; i < MAXNUM; i++){if (fire[i].nowy > fire[i].endy){for (int size = 5; size > 0; size--){int temp[] = { fire[i].rgb[0], fire[i].rgb[1], fire[i].rgb[2] };for (int k = 0; k < 3; k++){temp[k] += 50 * (5 - size);if (temp[k] > 255) temp[k] = 255;}setfillcolor(RGB(temp[0], temp[1], temp[2]));solidcircle(fire[i].nowx, fire[i].nowy + 15 * (10 - size), size);}}else{for (int a = 0; a < 360; a += 30){for (int size = 5; size > 0; size--){int x = cos(a * PI / 180.0) * (fire[i].explode + size * 10) + fire[i].nowx;int y = sin(a * PI / 180.0) * (fire[i].explode + size * 10) + fire[i].nowy + fire[i].radio / 2;int temp[] = { fire[i].rgb[0], fire[i].rgb[1], fire[i].rgb[2] };for (int k = 0; k < 3; k++){temp[k] += 50 * (5 - size);if (temp[k] > 255) temp[k] = 255;}setfillcolor(RGB(temp[0], temp[1], temp[2]));solidcircle(x, y + (HEIGHT - y) * 0.1 + size * (size - 2), size);}}}}
}void Move()
{for (int i = 0; i < MAXNUM; i++){if (fire[i].nowy > fire[i].endy){fire[i].nowy -= 3;}else{if (fire[i].explode >= fire[i].radio){fire[i].nowx = rand() % WIDTH;fire[i].nowy = HEIGHT + rand() % 250 + 50;fire[i].endy = rand() % 100 + 10;fire[i].radio = rand() % 50 + 120;fire[i].explode = 0;int c[][3] = { {255, 0, 0}, {210, 190, 255}, {255, 120, 0}, {255, 0, 150}, {255, 240, 100}, {10, 255, 255}, {160, 10, 255}, {255, 200, 60} };int n = rand() % 8;fire[i].color = RGB(c[n][0], c[n][1], c[n][2]);fire[i].rgb[0] = c[n][0];fire[i].rgb[1] = c[n][1];fire[i].rgb[2] = c[n][2];}else fire[i].explode++;}}
}int main()
{srand(time(NULL));initgraph(640, 480);Init();BeginBatchDraw();while (true){cleardevice();Draw();Move();FlushBatchDraw();Sleep(2);}EndBatchDraw();closegraph();return 0;
}

二:Python – 春联

运行效果:
在这里插入图片描述

from distutils.core import setup
from turtle import *
bgcolor("#FFFF00")
pensize(5)
setup(1000, 1000)
update()
fillcolor("red")
pencolor("firebrick2")pu()
goto(-330, 250)
seth(0)
pd()begin_fill()
for i in range(2):fd(360)left(90)fd(100)left(90)
end_fill()pencolor("black")
pu()texts = ["常", "乐", "安", "宁"]
for text in texts:fd(72)write(text, align="center", font=("华文行楷", 60, "normal"))pencolor("firebrick2")goto(-380, 200)
seth(180)
pd()begin_fill()
for i in range(2):fd(100)left(90)fd(560)left(90)
end_fill()pu()
goto(-430, 200)
pencolor("black")
seth(-90)texts = "常怀欣喜心常乐"
for text in texts:fd(80)write(text, align="center", font=("华文行楷", 60, "normal"))pencolor("firebrick2")
goto(180, 200)
seth(180)
pd()begin_fill()
for i in range(2):fd(100)left(90)fd(560)left(90)
end_fill()pu()
goto(130, 200)
pencolor("black")
seth(-90)texts = "欣悦四季心安宁"
for text in texts:fd(80)write(text, align="center", font=("华文行楷", 60, "normal"))
ht()
done()

三:Python – 烟花

运行效果:
在这里插入图片描述
在这里插入图片描述

import pygame
from random import randint
from random import uniform
from random import choice
import  math
vector = pygame.math.Vector2
# 重力变量
gravity = vector(0, 0.3)
# 控制窗口的大小
DISPLAY_WIDTH = DISPLAY_HEIGHT = 800# 颜色选项
trail_colours = [(45, 45, 45), (60, 60, 60), (75, 75, 75), (125, 125, 125), (150, 150, 150)]
dynamic_offset = 1
static_offset = 3
class Firework:def __init__(self):# 随机颜色self.colour = (randint(0, 255), randint(0, 255), randint(0, 255))self.colours = ((randint(0, 255), randint(0, 255), randint(0, 255)),(randint(0, 255), randint(0, 255), randint(0, 255)),(randint(0, 255), randint(0, 255), randint(0, 255)))self.firework = Particle(randint(0, DISPLAY_WIDTH), DISPLAY_HEIGHT, True,self.colour)  self.exploded = Falseself.particles = []self.min_max_particles = vector(100, 225)def update(self, win):  # 每帧调用if not self.exploded:self.firework.apply_force(gravity)self.firework.move()for tf in self.firework.trails:tf.show(win)self.show(win)if self.firework.vel.y >= 0:self.exploded = Trueself.explode()else:for particle in self.particles:particle.apply_force(vector(gravity.x + uniform(-1, 1) / 20, gravity.y / 2 + (randint(1, 8) / 100)))particle.move()for t in particle.trails:t.show(win)particle.show(win)def explode(self):# amount 数量amount = randint(self.min_max_particles.x, self.min_max_particles.y)for i in range(amount):self.particles.append(Particle(self.firework.pos.x, self.firework.pos.y, False, self.colours))def show(self, win):pygame.draw.circle(win, self.colour, (int(self.firework.pos.x), int(self.firework.pos.y)), self.firework.size)def remove(self):if self.exploded:for p in self.particles:if p.remove is True:self.particles.remove(p)if len(self.particles) == 0:return Trueelse:return Falseclass Particle:def __init__(self, x, y, firework, colour):self.firework = fireworkself.pos = vector(x, y)self.origin = vector(x, y)self.radius = 20self.remove = Falseself.explosion_radius = randint(5, 18)self.life = 0self.acc = vector(0, 0)self.trails = []  self.prev_posx = [-10] * 10  self.prev_posy = [-10] * 10  if self.firework:self.vel = vector(0, -randint(17, 20))self.size = 5self.colour = colourfor i in range(5):self.trails.append(Trail(i, self.size, True))else:self.vel = vector(uniform(-1, 1), uniform(-1, 1))self.vel.x *= randint(7, self.explosion_radius + 2)self.vel.y *= randint(7, self.explosion_radius + 2)# 向量self.size = randint(2, 4)self.colour = choice(colour)# 5 个 tails总计for i in range(5):self.trails.append(Trail(i, self.size, False))def apply_force(self, force):self.acc += forcedef move(self):if not self.firework:self.vel.x *= 0.8self.vel.y *= 0.8self.vel += self.accself.pos += self.velself.acc *= 0if self.life == 0 and not self.firework:  # 检查粒子的爆炸范围distance = math.sqrt((self.pos.x - self.origin.x) ** 2 + (self.pos.y - self.origin.y) ** 2)if distance > self.explosion_radius:self.remove = Trueself.decay()self.trail_update()self.life += 1def show(self, win):pygame.draw.circle(win, (self.colour[0], self.colour[1], self.colour[2], 0), (int(self.pos.x), int(self.pos.y)),self.size)def decay(self):  # random decay of the particlesif 50 > self.life > 10:  # early stage their is a small chance of decayran = randint(0, 30)if ran == 0:self.remove = Trueelif self.life > 50:ran = randint(0, 5)if ran == 0:self.remove = Truedef trail_update(self):self.prev_posx.pop()self.prev_posx.insert(0, int(self.pos.x))self.prev_posy.pop()self.prev_posy.insert(0, int(self.pos.y))for n, t in enumerate(self.trails):if t.dynamic:t.get_pos(self.prev_posx[n + dynamic_offset], self.prev_posy[n + dynamic_offset])else:t.get_pos(self.prev_posx[n + static_offset], self.prev_posy[n + static_offset])
class Trail:def __init__(self, n, size, dynamic):self.pos_in_line = nself.pos = vector(-10, -10)self.dynamic = dynamicif self.dynamic:self.colour = trail_colours[n]self.size = int(size - n / 2)else:self.colour = (255, 255, 200)self.size = size - 2if self.size < 0:self.size = 0def get_pos(self, x, y):self.pos = vector(x, y)def show(self, win):pygame.draw.circle(win, self.colour, (int(self.pos.x), int(self.pos.y)), self.size)def update(win, fireworks):for fw in fireworks:fw.update(win)if fw.remove():fireworks.remove(fw)pygame.display.update()def main():pygame.init()pygame.font.init()pygame.display.set_caption("祝您新年快乐")  # 标题background = pygame.image.load("./5.png")  # 背景sound_wav = pygame.mixer.music.load("2.mp3")pygame.mixer.music.play()pygame.init()
# 加载背景音乐
'''pygame.mixer.music.load("./res/音乐文件名")
# 循环播放背景音乐
pygame.mixer.music.play(-1)
# 停止背景音乐
pygame.mixer.music.stop()
# 加载音效
boom_sound = pygame.mixer.Sound("./res/音效名")
# 播放音效
boom_sound.play()
boom_sound.stop()
myfont = pygame.font.Font("simkai.TTF", 80)
myfont1 = pygame.font.Font("simkai.ttf", 30)
testsurface = myfont.render("虎虎生威", False, (0, 0, 0), (220, 20, 60))
testsurface1 = myfont1.render("", False, (251, 59, 85))'''win = pygame.display.set_mode((DISPLAY_WIDTH, DISPLAY_HEIGHT))
clock = pygame.time.Clock()fireworks = [Firework() for i in range(2)]  
running = Truewhile running:clock.tick(60)for event in pygame.event.get():if event.type == pygame.QUIT:running = Falseif event.type == pygame.KEYDOWN:if event.key == pygame.K_1:  # 按下 1fireworks.append(Firework())if event.key == pygame.K_2:  # 按下 2 加入10个烟花for i in range(10):fireworks.append(Firework())if event.key == pygame.K_3:  # 按下 3 加入100个烟花for i in range(100):fireworks.append(Firework())win.fill((20, 20, 30))  if randint(0, 20) == 1:  # 创建新的烟花fireworks.append(Firework())update(win, fireworks)
pygame.quit()
quit()if __name__ == 'main':main()

四:HTML – 烟花

运行效果:
在这里插入图片描述
在这里插入图片描述

<!DOCTYPE html>
<html dir="ltr" lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>夜空烟花</title><script type="text/javascript" src="http://g.huceo.com/weixin/qw/jquery.min.js"></script><script type="text/javascript"></script>
<style>
body {background: #000;margin: 0;
}canvas {cursor: crosshair;display: block;
}
.STYLE1 {color: #333333}
</style>
</head>
<div style="text-align:center;clear:both"></div>
<canvas id="canvas"><span class="STYLE1">Open IE effect more perfect </span></canvas>
<script>
window.requestAnimFrame = ( function() {return window.requestAnimationFrame ||window.webkitRequestAnimationFrame ||window.mozRequestAnimationFrame ||function( callback ) {window.setTimeout( callback, 1000 / 60 );};
})();var canvas = document.getElementById( 'canvas' ),ctx = canvas.getContext( '2d' ),cw = window.innerWidth,ch = window.innerHeight,fireworks = [],particles = [],hue = 120,limiterTotal = 5,limiterTick = 0,timerTotal = 80,timerTick = 0,mousedown = false,mx,my;canvas.width = cw;
canvas.height = ch;function random( min, max ) {return Math.random() * ( max - min ) + min;
}function calculateDistance( p1x, p1y, p2x, p2y ) {var xDistance = p1x - p2x,yDistance = p1y - p2y;return Math.sqrt( Math.pow( xDistance, 2 ) + Math.pow( yDistance, 2 ) );
}function Firework( sx, sy, tx, ty ) {this.x = sx;this.y = sy;this.sx = sx;this.sy = sy;this.tx = tx;this.ty = ty;this.distanceToTarget = calculateDistance( sx, sy, tx, ty );this.distanceTraveled = 0;this.coordinates = [];this.coordinateCount = 3;while( this.coordinateCount-- ) {this.coordinates.push( [ this.x, this.y ] );}this.angle = Math.atan2( ty - sy, tx - sx );this.speed = 2;this.acceleration = 1.05;this.brightness = random( 50, 70 );this.targetRadius = 1;
}Firework.prototype.update = function( index ) {this.coordinates.pop();this.coordinates.unshift( [ this.x, this.y ] );if( this.targetRadius < 8 ) {this.targetRadius += 0.3;} else {this.targetRadius = 1;}this.speed *= this.acceleration;var vx = Math.cos( this.angle ) * this.speed,vy = Math.sin( this.angle ) * this.speed;this.distanceTraveled = calculateDistance( this.sx, this.sy, this.x + vx, this.y + vy );if( this.distanceTraveled >= this.distanceToTarget ) {createParticles( this.tx, this.ty );fireworks.splice( index, 1 );} else {this.x += vx;this.y += vy;}
}Firework.prototype.draw = function() {ctx.beginPath();ctx.moveTo( this.coordinates[ this.coordinates.length - 1][ 0 ], this.coordinates[ this.coordinates.length - 1][ 1 ] );ctx.lineTo( this.x, this.y );ctx.strokeStyle = 'hsl(' + hue + ', 100%, ' + this.brightness + '%)';ctx.stroke();ctx.beginPath();ctx.arc( this.tx, this.ty, this.targetRadius, 0, Math.PI * 2 );ctx.stroke();
}function Particle( x, y ) {this.x = x;this.y = y;this.coordinates = [];this.coordinateCount = 5;while( this.coordinateCount-- ) {this.coordinates.push( [ this.x, this.y ] );}this.angle = random( 0, Math.PI * 2 );this.speed = random( 1, 10 );this.friction = 0.95;this.gravity = 1;this.hue = random( hue - 20, hue + 20 );this.brightness = random( 50, 80 );this.alpha = 1;this.decay = random( 0.015, 0.03 );
}Particle.prototype.update = function( index ) {this.coordinates.pop();this.coordinates.unshift( [ this.x, this.y ] );this.speed *= this.friction;this.x += Math.cos( this.angle ) * this.speed;this.y += Math.sin( this.angle ) * this.speed + this.gravity;this.alpha -= this.decay;if( this.alpha <= this.decay ) {particles.splice( index, 1 );}
}Particle.prototype.draw = function() {ctx. beginPath();ctx.moveTo( this.coordinates[ this.coordinates.length - 1 ][ 0 ], this.coordinates[ this.coordinates.length - 1 ][ 1 ] );ctx.lineTo( this.x, this.y );ctx.strokeStyle = 'hsla(' + this.hue + ', 100%, ' + this.brightness + '%, ' + this.alpha + ')';ctx.stroke();
}function createParticles( x, y ) {var particleCount = 30;while( particleCount-- ) {particles.push( new Particle( x, y ) );}
}function loop() {requestAnimFrame( loop );hue += 0.5;ctx.globalCompositeOperation = 'destination-out';ctx.fillStyle = 'rgba(0, 0, 0, 0.5)';ctx.fillRect( 0, 0, cw, ch );ctx.globalCompositeOperation = 'lighter';var i = fireworks.length;while( i-- ) {fireworks[ i ].draw();fireworks[ i ].update( i );}var i = particles.length;while( i-- ) {particles[ i ].draw();particles[ i ].update( i );}if( timerTick >= timerTotal ) {if( !mousedown ) {fireworks.push( new Firework( cw / 2, ch, random( 0, cw ), random( 0, ch / 2 ) ) );timerTick = 0;}} else {timerTick++;}if( limiterTick >= limiterTotal ) {if( mousedown ) {fireworks.push( new Firework( cw / 2, ch, mx, my ) );limiterTick = 0;}} else {limiterTick++;}
}canvas.addEventListener( 'mousemove', function( e ) {mx = e.pageX - canvas.offsetLeft;my = e.pageY - canvas.offsetTop;
});canvas.addEventListener( 'mousedown', function( e ) {e.preventDefault();mousedown = true;
});canvas.addEventListener( 'mouseup', function( e ) {e.preventDefault();mousedown = false;
});window.onload = loop;
</script>

上述代码复制后即可使用,无素材
轻舟在这里祝大家新年快乐,龙年迎好运!!!

相关文章:

新春快乐(烟花、春联)【附源码】

新春快乐 一&#xff1a; C语言 -- 烟花二&#xff1a;Python -- 春联三&#xff1a;Python -- 烟花四&#xff1a;HTML -- 烟花 一&#xff1a; C语言 – 烟花 运行效果&#xff1a; #include <graphics.h> #include <math.h> #include <time.h> #include…...

nextcloud 优化扩展

cd /config vi config.php #ONLYOFFICE allow_local_remote_servers > true, #应用商店加速 appstoreenabled > true, appstoreurl > https://www.orcy.net/ncapps/v2/, #nginx配置调优 add_header Strict-Transport-Security max-age15552000; add…...

【CSS】css如何实现字体大小小于12px?

【CSS】css如何实现字体大小小于12px? 问题解决方案transform: scale(0.5)&#xff08;常用&#xff09;SVG 矢量图设置text 问题 文字需要显示为12px&#xff0c;但是小于12px的&#xff0c;浏览器是显示不来的 解决方案 transform: scale(0.5)&#xff08;常用&#xff0…...

【Langchain+Streamlit】旅游聊天机器人

【LangchainStreamlit】打造一个旅游问答AI-CSDN博客 项目线上地址&#xff0c;无需openai秘钥可直接体验&#xff1a;http://101.33.225.241:8502/ github地址&#xff1a;GitHub - jerry1900/langchain_chatbot: langchainstreamlit打造的一个有memory的旅游聊天机器人&…...

〖大前端 - ES6篇②〗- let和const

说明&#xff1a;该文属于 大前端全栈架构白宝书专栏&#xff0c;目前阶段免费&#xff0c;如需要项目实战或者是体系化资源&#xff0c;文末名片加V&#xff01;作者&#xff1a;哈哥撩编程&#xff0c;十余年工作经验, 从事过全栈研发、产品经理等工作&#xff0c;目前在公司…...

JAVA设计模式之代理模式详解

代理模式 1 代理模式介绍 在软件开发中,由于一些原因,客户端不想或不能直接访问一个对象,此时可以通过一个称为"代理"的第三者来实现间接访问.该方案对应的设计模式被称为代理模式. 代理模式(Proxy Design Pattern ) 原始定义是&#xff1a;让你能够提供对象的替代…...

vivo发布2023 年度科技创新;阿里全新AI代理,可模拟人类操作手机

vivo 发布 2023 年度十大产品技术创新 近日&#xff0c;vivo 发布了「2023 年度科技创新」十大产品技术创新榜单&#xff0c;并将这些技术分为了 4 个板块。 「四大蓝科技」为 vivo 在去年推出的全新技术品牌&#xff0c;涵盖蓝晶芯片技术栈、蓝海续航系统、蓝心大模型、蓝河操…...

【制作100个unity游戏之23】实现类似七日杀、森林一样的生存游戏15(附项目源码)

本节最终效果演示 文章目录 本节最终效果演示系列目录前言实现树倒下的效果拾取圆木砍树消耗卡路里斧头手臂穿模问题处理源码完结 系列目录 前言 欢迎来到【制作100个Unity游戏】系列&#xff01;本系列将引导您一步步学习如何使用Unity开发各种类型的游戏。在这第23篇中&…...

python巧用定理判断素数

目录 判断一个数n是否是素数 求一个数的素因数个数 求大于等于指定数的最小素数 在数论中有三个非常重要的关于素数的定理 1、任何数都可以表示成若干个素数的乘积 2、任意数的素因子一个大于根号n的自然数&#xff0c;另一个与其对应的因子则必小于根号n。 3、除了2和3以…...

2023年总结

人们总说时间会改变一切&#xff0c;但事实上你得自己来。 今年开始给自己的时间读书、工作、生活都加上一个2.0的release版本号&#xff0c;相比过去的一年还是有很多进步的。 就跟git commit一样&#xff0c;一步一步提交优化&#xff0c;年底了发个版本。用李笑来的话说&am…...

Git中为常用指令配置别名

目录 1 前言 2 具体操作 2.1 创建.bashrc文件 2.2 添加指令 2.3 使其生效 2.4 测试 1 前言 在Git中有一些常用指令比较长&#xff0c;当我们直接输入&#xff0c;不仅费时费力&#xff0c;还容易出错。这时候&#xff0c;如果能给其取个简短的别名&#xff0c;那么事情就…...

STM32内部Flash

目录 一、内部Flash简介 二、内部Flash构成 1. 主存储器 2. 系统存储区 3. 选项字节 三、内部Flash写入过程 1. 解锁 2. 页擦除 3. 写入数据 四、工程空间分布 某工程的ROM存储器分布映像&#xff1a; 1. 程序ROM的加载与执行空间 2. ROM空间分布表 一、内部Flash…...

html5 audio video

DOMException: play() failed because the user didn‘t interact with the document first.-CSDN博客 不可用&#xff1a; 可用&#xff1a; Google Chrome Close AutoUpdate-CSDN博客...

LoveWall v2.0Pro社区型校园表白墙源码

校园表白墙&#xff0c;一个接近于社区类型的表白墙&#xff0c;LoveWall。 源码特色&#xff1b; 点赞&#xff0c; 发评论&#xff0c; 发弹幕&#xff0c; 多校区&#xff0c; 分享页&#xff0c; 涉及违禁物等名词进行检测&#xff01; 安装教程: 环境要求&#xff1b;…...

Flink cdc3.0动态变更表结构——源码解析

文章目录 前言源码解析1. 接收schema变更事件2. 发起schema变更请求3. schema变更请求具体处理4. 广播刷新事件并阻塞5. 处理FlushEvent6. 修改sink端schema 结尾 前言 上一篇Flink cdc3.0同步实例 介绍了最新的一些功能和问题&#xff0c;本篇来看下新功能之一的动态变更表结…...

WWW 2024 | 时间序列(Time Series)和时空数据(Spatial-Temporal)论文总结

WWW 2024已经放榜&#xff0c;本次会议共提交了2008篇文章&#xff0c;research tracks共录用约400多篇论文&#xff0c;录用率为20.2%。本次会议将于2024年5月13日-17日在新加坡举办。 本文总结了WWW 2024有关时间序列&#xff08;Time Series&#xff09;和时空数据&#xf…...

代码随想录算法——数组

目录 1、二分查找法 2、移除元素 3、有序数组的平方 4、长度最小的子数组 5、螺旋矩阵II 1、二分查找法 给定一个 n 个元素有序的&#xff08;升序&#xff09;整型数组 nums 和一个目标值 target &#xff0c;写一个函数搜索 nums 中的 target&#xff0c;如果目标值存在…...

Linux第45步_通过搭建“DNS服务器”学习图形化配置工具

学习的意义&#xff1a;通过搭建“DNS服务器”&#xff0c;来学习“图形化配置工具”。“DNS服务器”&#xff0c;我们用不到&#xff0c;但为后期移植linux系统服务&#xff0c;因为在移植系统时&#xff0c;需要用到这个“图形化配置工具”。 1、“menuconfig图形化配置工具…...

【Linux取经路】探寻shell的实现原理

文章目录 一、打印命令行提示符二、读取键盘输入的指令三、指令切割四、普通命令的执行五、内建指令执行5.1 cd指令5.2 export指令5.3 echo指令 六、结语 一、打印命令行提示符 const char* getusername() // 获取用户名 {return getenv("USER"); }const char* geth…...

【MATLAB】使用随机森林在回归预测任务中进行特征选择(深度学习的数据集处理)

1.随机森林在神经网络的应用 当使用随机森林进行特征选择时&#xff0c;算法能够为每个特征提供一个重要性得分&#xff0c;从而帮助识别对目标变量预测最具影响力的特征。这有助于简化模型并提高其泛化能力&#xff0c;减少过拟合的风险&#xff0c;并且可以加快模型训练和推理…...

Docker 离线安装指南

参考文章 1、确认操作系统类型及内核版本 Docker依赖于Linux内核的一些特性&#xff0c;不同版本的Docker对内核版本有不同要求。例如&#xff0c;Docker 17.06及之后的版本通常需要Linux内核3.10及以上版本&#xff0c;Docker17.09及更高版本对应Linux内核4.9.x及更高版本。…...

docker详细操作--未完待续

docker介绍 docker官网: Docker&#xff1a;加速容器应用程序开发 harbor官网&#xff1a;Harbor - Harbor 中文 使用docker加速器: Docker镜像极速下载服务 - 毫秒镜像 是什么 Docker 是一种开源的容器化平台&#xff0c;用于将应用程序及其依赖项&#xff08;如库、运行时环…...

解锁数据库简洁之道:FastAPI与SQLModel实战指南

在构建现代Web应用程序时&#xff0c;与数据库的交互无疑是核心环节。虽然传统的数据库操作方式&#xff08;如直接编写SQL语句与psycopg2交互&#xff09;赋予了我们精细的控制权&#xff0c;但在面对日益复杂的业务逻辑和快速迭代的需求时&#xff0c;这种方式的开发效率和可…...

[ICLR 2022]How Much Can CLIP Benefit Vision-and-Language Tasks?

论文网址&#xff1a;pdf 英文是纯手打的&#xff01;论文原文的summarizing and paraphrasing。可能会出现难以避免的拼写错误和语法错误&#xff0c;若有发现欢迎评论指正&#xff01;文章偏向于笔记&#xff0c;谨慎食用 目录 1. 心得 2. 论文逐段精读 2.1. Abstract 2…...

华为OD机试-食堂供餐-二分法

import java.util.Arrays; import java.util.Scanner;public class DemoTest3 {public static void main(String[] args) {Scanner in new Scanner(System.in);// 注意 hasNext 和 hasNextLine 的区别while (in.hasNextLine()) { // 注意 while 处理多个 caseint a in.nextIn…...

智能仓储的未来:自动化、AI与数据分析如何重塑物流中心

当仓库学会“思考”&#xff0c;物流的终极形态正在诞生 想象这样的场景&#xff1a; 凌晨3点&#xff0c;某物流中心灯火通明却空无一人。AGV机器人集群根据实时订单动态规划路径&#xff1b;AI视觉系统在0.1秒内扫描包裹信息&#xff1b;数字孪生平台正模拟次日峰值流量压力…...

JVM 内存结构 详解

内存结构 运行时数据区&#xff1a; Java虚拟机在运行Java程序过程中管理的内存区域。 程序计数器&#xff1a; ​ 线程私有&#xff0c;程序控制流的指示器&#xff0c;分支、循环、跳转、异常处理、线程恢复等基础功能都依赖这个计数器完成。 ​ 每个线程都有一个程序计数…...

MFC 抛体运动模拟:常见问题解决与界面美化

在 MFC 中开发抛体运动模拟程序时,我们常遇到 轨迹残留、无效刷新、视觉单调、物理逻辑瑕疵 等问题。本文将针对这些痛点,详细解析原因并提供解决方案,同时兼顾界面美化,让模拟效果更专业、更高效。 问题一:历史轨迹与小球残影残留 现象 小球运动后,历史位置的 “残影”…...

STM32HAL库USART源代码解析及应用

STM32HAL库USART源代码解析 前言STM32CubeIDE配置串口USART和UART的选择使用模式参数设置GPIO配置DMA配置中断配置硬件流控制使能生成代码解析和使用方法串口初始化__UART_HandleTypeDef结构体浅析HAL库代码实际使用方法使用轮询方式发送使用轮询方式接收使用中断方式发送使用中…...

MySQL 索引底层结构揭秘:B-Tree 与 B+Tree 的区别与应用

文章目录 一、背景知识&#xff1a;什么是 B-Tree 和 BTree&#xff1f; B-Tree&#xff08;平衡多路查找树&#xff09; BTree&#xff08;B-Tree 的变种&#xff09; 二、结构对比&#xff1a;一张图看懂 三、为什么 MySQL InnoDB 选择 BTree&#xff1f; 1. 范围查询更快 2…...