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

ICode国际青少年编程竞赛- Python-5级训练场-带参数函数

ICode国际青少年编程竞赛- Python-5级训练场-带参数函数

1、
在这里插入图片描述

def get_item(a):Dev.step(a)Dev.step(-a)
get_item(4)
Spaceship.step(2)
get_item(2)
Spaceship.step(3)
get_item(5)
Spaceship.step(2)
get_item(3)
Spaceship.step(3)
get_item(4)

2、
在这里插入图片描述

def get_item(a):   Dev.step(a)Dev.turnRight()Dev.step(1)Dev.step(-1)Dev.turnLeft()Dev.step(-a)
Spaceship.step(1)
get_item(5)
Spaceship.step(4)
get_item(3)
Spaceship.step(3)
get_item(4)
Spaceship.step(2)
get_item(2)
Spaceship.step(4)
get_item(7)

3、
在这里插入图片描述

def move(a, b, c):Spaceship.step(b)Spaceship.turnLeft()Spaceship.step(a)if c :for i in range(2): Spaceship.turnLeft()Spaceship.step(a)Spaceship.turnLeft()move(4, 2, 1)
move(2, 4, 1)
move(6, 4, 1)
move(3, 4, 0)

4、

在这里插入图片描述

def move(a):Dev.step(a)Dev.turnRight()Dev.step(2)Dev.turnLeft()Spaceship.step(2)Dev.step(-a)
move(5)
Spaceship.step(3)
move(4)
Spaceship.turnRight()
Dev.turnRight()
Spaceship.step()
move(3)
Spaceship.step(2)
move(6)

5、

在这里插入图片描述

def move(a):Dev.step(1)Flyer[a].step(1)for i in range(4):Dev.step(2)Dev.turnRight()Dev.step(-1)
move(0)
Spaceship.step(3)
Spaceship.turnRight()
Dev.turnRight()
move(1)
Spaceship.step(5)
move(2)

6、

在这里插入图片描述

def move(a):Flyer[a].step()Dev.step(-4)Dev.step(4)
Spaceship.step()
move(3)
Spaceship.step(3)
move(2)
Spaceship.step(2)
Spaceship.turnRight()
Spaceship.step()
Dev.turnLeft()
move(1)
Spaceship.step(3)
move(0)

7、

在这里插入图片描述

def move(a):for i in range(3):Flyer[a+i].step(1)Dev.step(5)Dev.step(-5)
move(0)
Spaceship.step(4)
Spaceship.turnLeft()
Spaceship.step(3)
move(3)
for i in range(2):Spaceship.turnRight()Spaceship.step(3-i*2)
Spaceship.turnLeft()
Spaceship.step()
move(6)
Spaceship.step(3)
move(9)

8、
在这里插入图片描述

def move(a):for i in range(3):Flyer[a+i].step()Dev.step(3)Dev.turnRight()Dev.step(2)Dev.turnLeft()Spaceship.step(2)Dev.step(-3)
Dev.step(2)
Spaceship.step()
move(0)
Spaceship.step(2)
move(3)
Spaceship.turnRight()
Dev.turnRight()
Spaceship.step()
move(6)

9、
在这里插入图片描述

def move(a):Dev.step(-a)Dev.step(a)
for i in (4, 4, 3):move(i)Spaceship.step(i - 1)
move(3)
Spaceship.turnRight()
Spaceship.step(1)
Dev.turnRight()
move(4)
Spaceship.step(3)
move(4)
Spaceship.turnRight()
Spaceship.step(1)
Dev.turnRight()
for i in range(2): move(2)Spaceship.step(1 + i)
move(5)
Spaceship.step(4)
move(5)

10、
在这里插入图片描述

def move(a):Dev.step(4)Dev.turnLeft()for i in range(4):Dev.step(a)Dev.turnRight()Dev.step(a)Dev.turnRight()Dev.step(-4)
move(1)
Spaceship.step(6)
move(3)
Spaceship.step(7)
move(2)

11、
在这里插入图片描述

def move(a, b):Dev.step(a)Dev.turnLeft()Dev.step(2)Dev.turnLeft()for i in range(2):Dev.step(1+i)Dev.turnRight()Dev.step(b)Dev.turnRight()Dev.step()Dev.turnRight()Dev.step(-2)Dev.turnRight()
move(2, 3)
move(5, 5)
move(4, 2)
move(6, 4)
Dev.step()

12、

在这里插入图片描述

def move(a, b):Spaceship.step(1)Dev.step(a)Dev.step(-a)Dev.turnLeft()Dev.step(a)Dev.step(-2 * a)Dev.step(a)if b > 0:for i in range(2): Spaceship.turnRight()Spaceship.step(b)
Spaceship.step(2)
Spaceship.turnLeft()
move(1, 2)
Spaceship.turnLeft()
Spaceship.step(4)
Spaceship.turnRight()
Dev.turnLeft()
move(2, 1)
Spaceship.turnRight()
Spaceship.step(3)
Spaceship.turnLeft()
Dev.turnLeft()
move(3, 4)
Spaceship.turnLeft()
move(-1, 0)

13、

在这里插入图片描述

def move(a, b, c, d):Dev.step(a)for i in range(c):if d != -2: Dev.turnRight()if d == -2: Dev.turnLeft()Dev.step(b)
move(2, 4, 3, 1)
for i in range(2):Dev.turnLeft()Dev.step(3-i)
move(0, 4, 3, 1)
Dev.turnRight()
move(-5, -2, 2, -2)
Dev.step(-1)
Dev.turnRight()
move(9, 3, 2, -2)

14、
在这里插入图片描述

def move(a, b):Dev.step(3)while Flyer[a].disappear(): wait()for i in range(4):Dev.step(2)Dev.turnRight()Dev.step(-b)move(0, 3)
for i in (5, 1, -2):Dev.turnRight()Dev.step(i)
Dev.turnRight()  move(1, 8)
Dev.turnRight()
Dev.step(4)
Dev.turnLeft()
move(2, 0)

15、
在这里插入图片描述

def move(a, b):Spaceship.step(b)Dev.step()while Flyer[a].disappear(): wait()Dev.step(3)Dev.step(-1)while Flyer[a].disappear(): wait()Dev.step(-3)
move(3, 1)
Spaceship.step()
Spaceship.turnRight()
Spaceship.step()
Spaceship.turnLeft()
move(0, 1)
Spaceship.step(2)
Spaceship.turnLeft()
move(4, 1)
Spaceship.turnRight()
Spaceship.step(3)
Spaceship.turnLeft()
move(1, 1)
Spaceship.turnRight()
move(2, 3)

16、

在这里插入图片描述

def move(a, b):Dev.step(a)while Dev.energy < 100:wait()Dev.step(b)Dev.turnRight()move(10, 1)
move(7, 0)
move(7, 0)
Dev.step(5)
Dev.turnLeft()
move(4, 0)
move(-8, 0)
Dev.step(7)

17、

在这里插入图片描述

def move(a, b):for i in range(2):Dev.step(a)Dev.turnRight()while Dev.energy < 100: wait()Dev.step(a)Dev.turnRight()Dev.step(b)
move(2, 1)
Dev.step(-4)
Dev.turnRight()
move(4, 4)
Dev.turnRight()
Dev.step(-3)
move(-3, -1)

18、

在这里插入图片描述

def move(a, b, c):Spaceship.step(a)for i in range(4):Dev.step(b-i)Dev.turnRight()if c == 1: Spaceship.step(2)Spaceship.turnLeft()Spaceship.step()Spaceship.turnRight()Dev.step(-1)
move(1, 5, 1)
move(4, 4, 1)
move(3, 6, 0)

19、
在这里插入图片描述

def move(a, x, b):Dev.step(a)for i in range(x):Dev.turnLeft()Dev.step(-1)if b == 2 and i == 3: Dev.step(-1)Dev.turnRight()Dev.step(1)if b == 2 and i == 2: Dev.step(1)Dev.turnRight()
move(2, 3, 1)
move(5, 6, 1)
move(5, 2, 1)
move(6, 5, 2)
Dev.step(1)

20、
在这里插入图片描述

def move(a, b, c, d, e):Spaceship.step(a)for i in range(b):Dev.step((5-i)*e)Dev.turnRight()if e != -1: Spaceship.step(c)Spaceship.turnLeft()Spaceship.step()if b != 2:Dev.step(-1)if b == 2:Dev.step(4)Spaceship.turnRight()
move(1, 4, 2, -1, 1)
move(4, 2, 4, -1, 1)
Spaceship.turnRight()
Spaceship.step(2)
Spaceship.turnLeft()
move(2, 5, 0, 0, -1)

相关文章:

ICode国际青少年编程竞赛- Python-5级训练场-带参数函数

ICode国际青少年编程竞赛- Python-5级训练场-带参数函数 1、 def get_item(a):Dev.step(a)Dev.step(-a) get_item(4) Spaceship.step(2) get_item(2) Spaceship.step(3) get_item(5) Spaceship.step(2) get_item(3) Spaceship.step(3) get_item(4)2、 def get_item(a): D…...

运维别卷系列 - 云原生监控平台 之 02.prometheus exporter 实践

文章目录 [toc]exporter 简介常用的 exporternode-exporter 实践创建 svc创建 daemonsetprometheus 配置服务发现 exporter 简介 随着 Prometheus 的流行&#xff0c;很多系统都已经自带了用于 Prometheus 监控的接口&#xff0c;例如 etcd、Kubernetes、CoreDNS 等&#xff0c…...

OSPF基本配置

1.启动OSPF进程 [rijospf1 router-id 1.1.1.1 --- 手工配置RID [r1-ospf-1) 2&#xff0c;创建区域 [r1-ospf-1]area 0 [r1-ospf-1-area-0.0.0.0) 3&#xff0c;宣告 目的:1&#xff0c;只有被宣告网段中的接口才能被激活。 --- 激活接口 ---- 只有激活的接口才能收发OSPF的…...

HIVE大数据平台SQL优化分享

相信很多小伙伴在面试的时候&#xff0c;必然跳不过去的一个问题就是SQL脚本的优化&#xff0c;这是很多面试官爱问的问题&#xff0c;也是可以证明你实力进阶的一个重要的能力。 下面给大家分享一个重量级的大数据行业sql技能---hive大数据平台SQL优化。 此文章是大数据平台…...

JS算法-十大排序算法(上)

思想小剧场 如果我的相对论被证明是正确的&#xff0c;德国人就会说我是德国人&#xff0c;法国人会说我是一个世界公民&#xff1b;如果我的相对论被否定了&#xff0c;法国佬就会骂我是德国鬼子&#xff0c;而德国人就会把我归为犹太人。—爱因斯坦 以下案例都是升序 const a…...

c++编程(11)——string类的模拟实现

欢迎来到博主的专栏——c编程 博主ID&#xff1a;代码小豪 文章目录 前言string类的模拟实现string的成员对象构造、赋值、析构访问成员对象的接口访问字符串中的元素迭代器对字符序列的插入、删除元素操作mystring类的相关操作 mystring类的所有模拟实现以及测试案例 前言 本…...

Python从0到POC编写--函数

数学函数&#xff1a; 1. len len() 函数返回对象&#xff08;字符、列表、元组等&#xff09;长度或项目个数&#xff0c; 例如&#xff1a; str "python" len(str)2. range range() 函数返回的是一个可迭代对象&#xff08;类型是对象&#xff09;&#xff0c;…...

【教程】Linux/Jetson 安装X11VNC同步屏幕内容

转载请注明出处&#xff1a;小锋学长生活大爆炸[xfxuezhagn.cn] 如果本文帮助到了你&#xff0c;请不吝给个[点赞、收藏、关注]哦~ 目录 背景说明 实际效果 安装步骤 安装 x11vnc 配置 x11vnc 配置 x11vnc 作为系统服务 使用 VNC 客户端连接 背景说明 通常vnc-server是单…...

【LLM第五篇】名词解释:prompt

1.是什么 提示工程&#xff08;Prompt Engineering&#xff09;是一门较新的学科&#xff0c;关注提示词开发和优化&#xff0c;帮助用户将大语言模型&#xff08;Large Language Model, LLM&#xff09;用于各场景和研究领域。 掌握了提示工程相关技能将有助于用户更好地了解…...

k8s v1.20二进制部署 部署 CNI 网络组件 部署 Calico

一、部署 flannel 1.1.K8S 中 Pod 网络通信 ●Pod 内容器与容器之间的通信 在同一个 Pod 内的容器&#xff08;Pod 内的容器是不会跨宿主机的&#xff09;共享同一个网络命名空间&#xff0c;相当于它们在同一台机器上一样&#xff0c;可以用 localhost 地址访问彼此的端口。…...

在React中利用Postman测试代码获取数据

文章目录 概要名词解释1、Postman2、axios 使用Postman测试API在React中获取并展示数据小结 概要 在Web开发中&#xff0c;通过API获取数据是一项常见任务。Postman是一个功能强大的工具&#xff0c;可以帮助开发者测试API&#xff0c;并查看API的响应数据。在本篇博客中&…...

嵌入式学习-通用定时器

简介 框图介绍 时钟选择 计数器部分 输入捕获和输出比较框图 嵌入式学习全文参考&#xff08;小向是个der&#xff09;做笔记&#xff1a;https://blog.csdn.net/qq_41954556/article/details/129735708...

培训行业有哪些ai工具?

培训行业利用人工智能&#xff08;AI&#xff09;工具的方式多种多样&#xff0c;其中一些常见的工具包括&#xff1a; 1. **经AI深度学习的OCR软件**&#xff1a;OCR能给培训行业带来很大的便利&#xff0c;能大大提高工作效率和降低文字录入的成本&#xff0c;但一般的OCR工具…...

7.STL中string的一些超常用函数 (附习题)

目录 1.find 2.atoi 3.to_string 4.getline 【leetcode 习题】 387.字符串中的第一个唯一字符 125. 验证回文串 1.find 1.查找第一次出现的目标字符串&#xff1a;说明&#xff1a;如果查找成功则输出查找到的第一个位置&#xff0c;否则返回-1&#xff1b; s1.find(s2…...

GPT搜索鸽了!改升级GPT-4

最近OpenAI太反常&#xff0c;消息一会一变&#xff0c;直让人摸不着头脑。 奥特曼最新宣布&#xff1a;5月13日开发布会&#xff0c;不是GPT-5&#xff0c;也不是盛传的GPT搜索引擎&#xff0c;改成对ChatGP和GPT-4的升级&#xff5e; 消息一出&#xff0c;大伙儿都蒙了。 之…...

数字绘画教学实训解决方案

一、建设背景 1.1政策背景 教育信息化政策推动&#xff1a;近年来&#xff0c;随着教育信息化政策的不断推动&#xff0c;各级教育部门纷纷出台相关政策&#xff0c;鼓励和支持教育信息化的发展。数字绘画作为现代艺术教育的重要组成部分&#xff0c;其教学实训解决方案的建设…...

C#之如何判断数据类型

一、GetType方法 a.GetType()&#xff1a;获取当前变量的类型对象 string str "Hello World";Console.WriteLine(str.GetType()); 结果: 二、typeof方法 typeof(Int)&#xff1a;获取的是Int类型的类型对象 int num 10;Console.WriteLine(num.GetType() typeof(i…...

算法学习笔记(Tarjan)

本文介绍 T a r j a n Tarjan Tarjan求强联通分量、找割点和割边、找环。 Tarjan求强联通分量 例题&#xff1a;【模板】有向图缩点 题目描述 给定一个 n n n点 m m m边的有向图&#xff08;保证不存在重边与自环&#xff0c;但不保证连通&#xff09;&#xff0c;请你求出…...

一台linux通过另一台linux访问互联网-TinyProxy

参考&#xff1a; https://blog.csdn.net/weixin_41831919/article/details/113061317https://www.yuncongz.com/archives/1.htmlhttps://blog.csdn.net/aoc68397/article/details/101893369 环境&#xff1a;ubuntu 18.04 机器1: IP 219.216.65.252 (可以访问外网) 机器2: IP…...

探索数据结构:堆的具体实现与应用

✨✨ 欢迎大家来到贝蒂大讲堂✨✨ &#x1f388;&#x1f388;养成好习惯&#xff0c;先赞后看哦~&#x1f388;&#x1f388; 所属专栏&#xff1a;数据结构与算法 贝蒂的主页&#xff1a;Betty’s blog 1. 堆的概念 堆(Heap)是计算机科学中一类特殊的数据结构。堆通常是一个…...

【AI】了解ChatMemory 底层实现机制

&#xff08;说实在&#xff0c;看个 七、整体架构总结 就行了&#xff09; 为何要了解底层原理&#xff0c;其意义在于出问题好排查&#xff0c;写代码时有思路。 基于源码调试与运行时验证&#xff0c;深度拆解ChatMemory 底层实现机制&#xff0c;重点解析 ChatMemoryStor…...

地平线6正式上线!UU远程云电脑工作日也能全高画质飙车

《极限竞速&#xff1a;地平线6》5月18日正式全球发售&#xff01;该作将舞台设在超燃的日本东京&#xff0c;从东京涩谷的霓虹璀璨&#xff0c;到秋名山的晨雾缭绕与漂移快感;从北海道的茫茫雪原越野&#xff0c;到富士山下的樱花赛道浪漫驰骋&#xff0c;每一处场景都细节拉满…...

告别黑白日志!用Xshell正则高亮集,让服务器报错、成功信息一目了然

告别黑白日志&#xff01;用Xshell正则高亮集&#xff0c;让服务器报错、成功信息一目了然 在运维和开发人员的日常工作中&#xff0c;与服务器打交道是家常便饭。无论是查看系统日志、调试应用程序&#xff0c;还是执行自动化脚本&#xff0c;我们都需要面对大量的命令行输出信…...

Delphi二进制迷宫破解:IDR交互式重构器的逆向工程革命

Delphi二进制迷宫破解&#xff1a;IDR交互式重构器的逆向工程革命 【免费下载链接】IDR Interactive Delphi Reconstructor 项目地址: https://gitcode.com/gh_mirrors/id/IDR 在逆向工程的世界里&#xff0c;Delphi编译的程序犹如一座座精心设计的迷宫——结构复杂、入…...

DeepSpeed v0.19.0 重大更新:训练稳定性、ZeRO、FPQuantizer、DeepCompile、Sequence Parallelism 全面增强,20 位贡献者带来 28 次提交

如果你正在关注 DeepSpeed 的最新版本&#xff0c;那么 v0.19.0 绝对值得重点解读。 这次更新覆盖范围非常广&#xff0c;从 版本号更新、Transpose 重构、进程组关闭卡死修复、ZeRO 相关修复、CPU offload 梯度问题修复、DeepCompile 兼容性修复、PyTorch 版本选择、FPQuantiz…...

开源项目Markdown Viewer:如何打造完美的浏览器Markdown阅读体验

开源项目Markdown Viewer&#xff1a;如何打造完美的浏览器Markdown阅读体验 【免费下载链接】markdown-viewer Markdown Viewer / Browser Extension 项目地址: https://gitcode.com/gh_mirrors/ma/markdown-viewer 作为一款功能强大的开源项目&#xff0c;Markdown Vi…...

别再死记硬背了!用Python模拟一个简单的图灵机,帮你彻底搞懂计算理论

用Python构建图灵机&#xff1a;从理论到代码的沉浸式学习 在计算机科学教育中&#xff0c;图灵机常被视为一个抽象难懂的概念——那些状态转移符号和无限长的纸带总让人望而生畏。但当我第一次用代码实现了一个简单的图灵机后&#xff0c;整个计算理论突然变得清晰可见。本文将…...

独立开发者如何借助Taotoken管理多个AI侧项目

&#x1f680; 告别海外账号与网络限制&#xff01;稳定直连全球优质大模型&#xff0c;限时半价接入中。 &#x1f449; 点击领取海量免费额度 独立开发者如何借助Taotoken管理多个AI侧项目 作为一名独立开发者&#xff0c;同时维护多个使用大模型的小型项目是常态。你可能有…...

减 10 斤 vs 瘦 10 斤,别再被体重秤骗了!

外行看体重&#xff0c;内行看体脂。 减重 10 斤&#xff0c;你掉的可能只是水分、肌肉、肠道废物&#xff0c;身材看着没变化。 瘦 10 斤&#xff08;减脂&#xff09;&#xff0c;才是真正减掉脂肪组织&#xff0c;身材会明显小一圈&#xff0c;腰围、腿围肉眼可见地缩小。 这…...

小白程序员必看:四步轻松构建你的第一个AI编码Agent,收藏学习!

本文详细介绍了如何通过四个步骤构建一个基础的AI编码Agent&#xff0c;包括接入大型语言模型&#xff08;LLM&#xff09;、添加实用工具&#xff08;如读取、写入和执行文件&#xff09;、构建Agent循环以及实现对话循环。文章以Python语言为例&#xff0c;逐步引导读者完成整…...