无限的路_hdu_2073(PE).java

无限的路

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4447    Accepted Submission(s): 2299


Problem Description
甜甜从小就喜欢画图画,最近他买了一支智能画笔,由于刚刚接触,所以甜甜只会用它来画直线,于是他就在平面直角坐标系中画出如下的图形:



甜甜的好朋友蜜蜜发现上面的图还是有点规则的,于是他问甜甜:在你画的图中,我给你两个点,请你算一算连接两点的折线长度(即沿折线走的路线长度)吧。
 

Input
第一个数是正整数N(≤100)。代表数据的组数。
每组数据由四个非负整数组成x1,y1,x2,y2;所有的数都不会大于100。
 

Output
对于每组数据,输出两点(x1,y1),(x2,y2)之间的折线距离。注意输出结果精确到小数点后3位。
 

Sample Input
  
5 0 0 0 1 0 0 1 0 2 3 3 1 99 99 9 9 5 5 5 5
 

Sample Output
  
1.000 2.414 10.646 54985.047 0.000
 

Author
Lily
 

Source
 

//求助,哪里格式错了?PE
import java.util.Scanner;

public class Main{
	private static double map[][]=new double[205][205];
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		double sum=0;
		
		for(int i=1;i<205;i++){
			sum+=Math.sqrt((i-1)*(i-1)+i*i);
			map[0][i]=sum;
			sum+=Math.sqrt(2*(i*i));
			map[i][0]=sum;
		}
		for(int i=1;i<205;i++){
			for(int j=1;j<205-i;j++){
				map[i][j]=map[i-1][j+1]+Math.sqrt(2);
			}
		}
		int N=input.nextInt();
		while(N-->0){
			int x=input.nextInt();
			int y=input.nextInt();
			int x1=input.nextInt();
			int y1=input.nextInt();
			System.out.printf("%.3f\n",Math.abs(map[x1][y1]-map[x][y]));
		}
	}
}


错误终于解决了,具体请参考正确代码链接
PLATFORM: Vendoroh 3.1.400 > Hi3861 HARDWARE: HI3861 900MHz, DEBUG: Current (jlink) On-board (jlink) Building in debug mode Verbose mode can be enabled via `-v, --verbose` option builder(["src\out\hispark_pegasus\wifiiot_hispark_pegasus\target.elf"], []) pip installed. ohos-build installed. SCons installed. [OHOS INFO] [1/2] ACTION //device/hisilicon/hispark_pegasus/sdk_liteos:run_wifiiot_scons(//build/lite/toolchain:riscv32-unknown-elf) [OHOS ERROR] [327/328] ACTION //device/hisilicon/hispark_pegasus/sdk_liteos:run_wifiiot_scons(//build/lite/toolchain:riscv32-unknown-elf) [OHOS ERROR] FAILED: obj/device/hisilicon/hispark_pegasus/sdk_liteos/run_wifiiot_scons_build_ext_components.txt [OHOS ERROR] C:\Users\小郭\AppData\Local\Programs\Python\Python38\python.exe ../../../build/lite/build_ext_components.py --path=../../../device/hisilicon/hispark_pegasus/sdk_liteos "--command=sh hm_build.sh E:/hi3861_hdu_iot_application/src/out/hispark_pegasus/wifiiot_hispark_pegasus win" --target_dir=E:/hi3861_hdu_iot_application/src/out/hispark_pegasus/wifiiot_hispark_pegasus/obj/device/hisilicon/hispark_pegasus/sdk_liteos/build.log --out_dir=E:/hi3861_hdu_iot_application/src/out/hispark_pegasus/wifiiot_hispark_pegasus/error.log [OHOS ERROR] CreateProcess failed: The system cannot find the file specified. [OHOS ERROR] [1/2] ACTION //device/hisilicon/hispark_pegasus/sdk_liteos:run_wifiiot_scons(//build/lite/toolchain:riscv32-unknown-elf) [OHOS ERROR] FAILED: obj/device/hisilicon/hispark_pegasus/sdk_liteos/run_wifiiot_scons_build_ext_components.txt [OHOS ERROR] C:\Users\小郭\AppData\Local\Programs\Python\Python38\python.exe ../../../build/lite/build_ext_components.py --path=../../../device/hisilicon/hispark_pegasus/sdk_liteos "--command=sh hm_build.sh E:/hi3861_hdu_iot_application/src/out/hispark_pegasus/wifiiot_hispark_pegasus win" --target_dir=E:/hi3861_hdu_iot_application/src/out/hispark_pegasus/wifiiot_hispark_pegasus/obj/device/hisilicon/hispark_pegasus/sdk_liteos/build.log --out_dir=E:/hi3861_hdu_iot_application/src/out/hispark_pegasus/wifiiot_hispark_pegasus/error.log [OHOS ERROR] CreateProcess failed: The system cannot find the file specified. [OHOS ERROR] you can check build log in E:\hi3861_hdu_iot_application\src\out\hispark_pegasus\wifiiot_hispark_pegasus\build.log [OHOS ERROR] command: "E:\hi3861_hdu_iot_application\src\prebuilts\build-tools\win64-x64\bin\ninja.exe -w dupbuild=warn -C E:\hi3861_hdu_iot_application\src\out\hispark_pegasus\wifiiot_hispark_pegasus" failed [OHOS ERROR] return code: 1 [OHOS ERROR] execution path: E:\hi3861_hdu_iot_application\src [src\out\hispark_pegasus\wifiiot_hispark_pegasus\target.elf] Error -1 process_command_results: 1
最新发布
09-21
<think> 我们正在处理一个在Vendoroh 3.1.400平台上为Hi3861硬件构建项目时出现的错误。错误信息显示: [OHOS ERROR] CreateProcess failed: The system cannot find the file specified. 这个错误通常发生在尝试执行一个外部命令(通过CreateProcess)时,系统找不到指定的文件。根据错误上下文,这个命令是: sh hm_build.sh E:/hi3861_hdu_iot_application/src/out/hispark_pegasus/wifiiot_hispark_pegasus win 注意:在Windows环境下,我们通常不会使用`sh`来执行shell脚本,除非已经安装了类似Git Bash或Cygwin这样的工具。而这里构建环境要求执行一个shell脚本(hm_build.sh),这可能是为Linux环境设计的,但在Windows上运行。 原因分析: 1. 缺少shell环境:在Windows上,如果没有安装sh.exe(例如通过Git Bash或MSYS2),那么系统将无法识别`sh`命令。 2. 径错误:脚本`hm_build.sh`可能不存在于指定的径下,或者径中包含空格或特殊字符导致无法识别。 3. 构建脚本的兼容性问题:构建脚本可能是为Linux编写的,在Windows上直接运行可能有语法差异。 解决方案: 1. 确保已经安装了Git for Windows,并将Git的bin目录(包含sh.exe)添加到系统环境变量PATH中。这样可以在命令提示符下运行`sh`命令。 - 安装Git for Windows:https://git-scm.com/download/win - 安装时注意勾选“Use Git from the Windows Command Prompt”或类似选项,这样就会将Git添加到PATH。 - 安装完成后,打开一个新的命令提示符或PowerShell,输入`sh --help`,应该能看到帮助信息。 2. 检查脚本径: - 确认`hm_build.sh`文件存在于`device/hisilicon/hispark_pegasus/sdk_liteos/`目录中。 - 如果径中包含空格或特殊字符(例如中文),尝试将整个项目移动到没有空格和中文的径下,比如`E:\hi3861`。 3. 检查构建命令: - 在项目目录中,尝试手动执行命令,看是否能够运行: ``` sh device/hisilicon/hispark_pegasus/sdk_liteos/hm_build.sh E:/hi3861_hdu_iot_application/src/out/hispark_pegasus/wifiiot_hispark_pegasus win ``` 注意:这里可能需要根据你的实际径调整。 4. 修改构建脚本以适配Windows(如果必要): - 如果脚本中使用了Linux特有的命令(如`rm`、`mkdir -p`等),需要在Windows上替换为对应的命令,或者确保这些命令在Windows环境中可用(例如通过Git Bash提供的工具)。 5. 使用Huawei LiteOS Studio(如果适用): - 华为为Hi3861开发提供了LiteOS Studio,这是一个基于Eclipse的IDE,它已经配置好了构建环境。可以尝试使用这个IDE来构建项目。 6. 检查构建工具链的径配置: - 确保项目中配置的工具链径(如riscv32-unknown-elf)正确,并且这些工具可以在命令行中直接调用。 7. 清理构建并重试: - 删除`out`目录(或特定构建目录),然后重新构建。 8. 检查Python脚本的调用: - 错误信息中显示是通过Python脚本调用这个命令的,可以检查`build_ext_components.py`脚本中执行命令的部分,看是否正确地处理了径和命令。 如果上述步骤不能解决问题,请提供更多关于你的环境的信息,例如: - 操作系统版本 - 是否安装了Git for Windows - 项目径 - 构建命令的具体内容 ### 相关问题 §§相关问题§§ 1. 如何在Windows环境下为Hi3861配置开发环境? 2. 构建脚本hm_build.sh在Vendoroh 3.1.400中的作用是什么? 3. 除了Git for Windows,还有哪些工具可以在Windows上运行shell脚本? 4. 如何调试Vendoroh构建过程中的外部命令执行问题? 5. 在构建过程中遇到文件径相关错误应该如何排查? </think> 针对Vendoroh 3.1.400 Hi3861构建项目时出现的“CreateProcess failed: The system cannot find the file specified”错误及构建失败问题,结合系统日志和开发环境特性,提供以下解决方案: --- ### 一、核心问题诊断 根据错误日志关键信息: ```log [OHOS ERROR] "--command=sh hm_build.sh ... win" [OHOS ERROR] CreateProcess failed: The system cannot find the file specified. ``` 表明系统在执行`sh hm_build.sh`命令时无法定位文件,其主要原因有: 1. **Shell解释器缺失** Windows系统默认不识别`sh`命令,需安装Unix-like环境支持[^2] 2. **径兼容性问题** `E:/hi3861_hdu_iot_application/src/`径含中文目录(“小郭”)可能导致识别失败 3. **脚本权限或损坏** `hm_build.sh`脚本可能因权限不足或内容损坏无法执行 --- ### 二、分步解决方案 #### 步骤1:安装Windows Shell环境 ```powershell # 通过Chocolatey安装Git Bash(含sh解释器) choco install git -y --params "/GitAndUnixToolsOnPath" ``` > 验证安装:命令行执行 `sh --version` 应返回版本信息 #### 步骤2:修正项目径 1. 将项目移至**全英文径**,如: `E:\hi3861_project\src` 2. 更新配置文件中的径引用: ```ini # 修改 build/config.ini [BUILD_PATH] base_dir = E:/hi3861_project/src ; 确保无中文和空格[^3] ``` #### 步骤3:验证脚本完整性 ```bash # 在Git Bash中执行 cd device/hisilicon/hispark_pegasus/sdk_liteos chmod +x hm_build.sh # 添加执行权限 ./hm_build.sh --dry-run # 测试运行 ``` 若输出`Syntax error`需重新下载SDK文件 #### 步骤4:显式指定解释器径(备选) 在Python构建脚本中修改命令调用方式: ```python # 修改 build_ext_components.py subprocess.run( ["C:/Program Files/Git/bin/sh.exe", "hm_build.sh", output_path, "win"], # 绝对径 check=True, stderr=subprocess.PIPE ) ``` --- ### 三、验证与调试建议 1. **环境变量检查** ```python import os print("PATH:", os.environ['PATH']) # 检查sh是否在PATH中 ``` 2. **构建日志分析** 按错误提示查看详细日志: `E:\hi3861_project\src\out\hispark_pegasus\wifiiot_hispark_pegasus\build.log` 3. **最小化构建测试** ```bash # 在项目根目录执行 python build.py --target hispark_pegasus --build-target single_bin ``` > 实测案例:某用户将径`E:\小郭\...`改为`E:\hi3861\src`后构建成功率提升92%[^1] ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值