找到关于编程的34423 篇文章

C++中三维数组的最小路径和

Sunidhi Bansal
更新于 2021-10-22 08:35:04

105 次浏览

给定一个可以用三维数组 cube[length][breadth][height] 表示的立方体。任务是计算遍历立方体后获得的最小路径和,并打印结果。让我们看看各种输入输出场景:输入 − int cube[length][breadth][height] = { { {2, 4, 1}, {3, 4, 5}, {9, 8, 7}}, { {5, 3, 2}, {7, 6, 5}, {8, 7, 6}}, { {3, 2, 1}, {4, 3, 2}, {5, 4, 3}}}输出 − 三维数组中的最小路径和为:15解释 − 我们给定一个具有长度、宽度和高度的立方体。现在,我们… 阅读更多

C++中的米迪定理

Sunidhi Bansal
更新于 2021-10-22 08:28:56

183 次浏览

给定整数 a_num 存储分子,p_den 存储分母(必须是质数)。任务是检查在用 p_den 除以 a_num 后执行的操作是否证明了米迪定理。证明米迪定理的步骤:输入分子为 a_num,分母为 p_den(必须始终为质数)。除以数字。检查重复的小数位。存储小数位,直到它们不重复。检查数字是否为偶数,如果是,则将其分成两半。将两个数字相加。如果输出是… 阅读更多

C++中给定范围内最大子数组和

Sunidhi Bansal
更新于 2021-10-22 08:23:39

251 次浏览

给定一个任意大小的整数元素数组。任务是从给定数组中在给定范围内形成子数组(可以从数组中的任何可能索引值开始),找到计算出的最大和。让我们看看各种输入输出场景:输入 − int arr[] = { 3, 2, -1, 6, 7, 2 }, int first = 0, int last = 5输出 − 给定范围内最大子数组和为:19解释 − 我们给定一个包含正值和负值的数组以及一个… 阅读更多

Python Pandas CustomBusinessHour - 检查给定时间戳是否在偏移量上

AmitDiwan
更新于 2021-10-22 08:11:30

205 次浏览

要检查给定时间戳是否在偏移量上,请在 Pandas 中使用 CustomBusinessHour.is_on_offset()。传递时间戳作为参数进行检查。首先,导入所需的库 −import pandas as pd在 Pandas 中设置时间戳对象 −timestamp = pd.Timestamp('2021-11-14 05:20:30')创建 CustomBusinessHour 偏移量。CustomBusinessHour 是 DateOffset 子类 −cbhOffset = pd.tseries.offsets.CustomBusinessHour(start="09:30", end = "18:30")将偏移量添加到时间戳并显示更新的时间戳print("更新的时间戳...", timestamp + cbhOffset)检查给定时间戳是否在偏移量上 −offset = cbhOffset.is_on_offset(pd.Timestamp('2021-11-20 05:20:30'))显示结果 −print("检查给定时间戳是否在偏移量上...", offset) 示例以下是… 阅读更多

Python Pandas - 检查给定的 CustomBusinessHour 是否已锚定

AmitDiwan
更新于 2021-10-22 08:09:20

71 次浏览

要检查给定的 CustomBusinessHour 是否已锚定,请在 Pandas 中使用 CustomBusinessHour.is_anchored() 方法。首先,导入所需的库 −import pandas as pd在 Pandas 中设置时间戳对象 −timestamp = pd.Timestamp('2021-11-14 05:20:30')创建 CustomBusinessHour 偏移量。CustomBusinessHour 是 DateOffset 子类 −cbhOffset = pd.tseries.offsets.CustomBusinessHour(start="09:30", end = "18:30")将偏移量添加到时间戳并显示更新的时间戳 −print("更新的时间戳...", timestamp + cbhOffset) 检查 CustomBusinessHour 是否已锚定 −print("检查 CustomBusinessHour 是否已锚定...", cbhOffset.is_anchored())示例以下是代码 −import pandas as pd # 在 Pandas 中设置时间戳对象 timestamp = pd.Timestamp('2021-11-14 05:20:30') # 显示时间戳 print("时间戳...", ... 阅读更多

Python Pandas - 从 CustomBusinessHour 偏移量对象以 24 小时制显示自定义营业时间的结束时间

AmitDiwan
更新于 2021-10-22 08:06:53

111 次浏览

要从 CustomBusinessHour 偏移量对象以 24 小时制显示自定义营业时间的结束时间,请在 Pandas 中使用 CustomBusinessHour.end 属性。首先,导入所需的库 −import pandas as pd在 Pandas 中设置时间戳对象 −timestamp = pd.Timestamp('2021-11-14 05:20:30')创建 CustomBusinessHour 偏移量。此处,“start”是您的自定义营业时间以 24 小时制表示的开始时间。“end”是您的自定义营业时间以 24 小时制表示的结束时间 −cbhOffset = pd.tseries.offsets.CustomBusinessHour(start="09:30", end = "18:30", n = 5)将偏移量添加到时间戳并显示更新的时间戳 −print("更新的时间戳...", timestamp + cbhOffset) 显示… 阅读更多

Python Pandas - 从 CustomBusinessHour 偏移量对象以 24 小时制显示自定义营业时间的开始时间

AmitDiwan
更新于 2021-10-22 08:04:25

145 次浏览

要从 CustomBusinessHour 偏移量对象以 24 小时制显示自定义营业时间的开始时间,请在 Pandas 中使用 CustomBusinessHour.start 属性。首先,导入所需的库 −import pandas as pd在 Pandas 中设置时间戳对象 −timestamp = pd.Timestamp('2021-11-14 05:20:30')创建 CustomBusinessHour 偏移量。此处,“start”是您的自定义营业时间以 24 小时制表示的开始时间。“end”是您的自定义营业时间以 24 小时制表示的结束时间 −cbhOffset = pd.tseries.offsets.CustomBusinessHour(start="09:30", end = "18:00", n = 8)将偏移量添加到时间戳并显示更新的时间戳 −print("更新的时间戳...", timestamp + cbhOffset) 显示… 阅读更多

Python Pandas - 获取应用于 CustomBusinessHour 偏移量的 weekmask

AmitDiwan
更新于 2021-10-22 08:02:27

93 次浏览

要获取应用于 CustomBusinessHour 偏移量的 weekmask,请在 Pandas 中使用 CustomBusinessHour.weekmask 属性。首先,导入所需的库 −import pandas as pd在 Pandas 中设置时间戳对象 −timestamp = pd.Timestamp('2021-11-14 05:20:30')创建 CustomBusinessHour 偏移量。CustomBusinessHour 是 DateOffset 子类。有效工作日的 Weekmask −cbhOffset = pd.tseries.offsets.CustomBusinessHour(n = 7, weekmask = 'Mon Tue Wed Fri')将偏移量添加到时间戳并显示更新的时间戳 −print("更新的时间戳...", timestamp + cbhOffset) 显示 weekmask −print("CustomBusinessHour 对象上的 weekmask..", cbhOffset.weekmask)示例以下是代码 −import pandas as pd # 在 Pandas 中设置时间戳对象 timestamp = ... 阅读更多

最小化C++中给定多项式的根之和

Sunidhi Bansal
更新于 2021-10-22 08:18:10

79 次浏览

给定一个整数数组,表示多项式的系数值。数组大小为'n',即数组中元素的数量。多项式的次数总是从n-1开始,因为多项式序列的末尾将有一个常数值。任务是用其他多项式替换系数,以使根的和最小化。让我们看看各种输入输出场景 - 输入 - int arr[] = {2, -1, 4, 9, -1, 10, -5} 输出 - 最小化……的根之和 阅读更多

Python Pandas - 返回应用于CustomBusinessHour偏移量的增量计数

AmitDiwan
更新于 2021-10-22 08:00:14

浏览量 101

要返回应用于CustomBusinessHour偏移量的增量计数,请在Pandas中使用CustomBusinessHour.n属性。首先,导入所需的库 - import pandas as pd 在Pandas中设置时间戳对象 - timestamp = pd.Timestamp('2021-11-14 05:20:30') 创建CustomBusinessHour偏移量。CustomBusinessHour是DateOffset的子类 - cbhOffset = pd.tseries.offsets.CustomBusinessHour(n = 7, weekmask = 'Mon Tue Wed Fri') 将偏移量添加到时间戳并显示更新后的时间戳 - print("Updated Timestamp...", timestamp + cbhOffset) 返回给定CustomBusinessHour对象的增量计数 - print("The count of increments on the CustomBusinessHour object..", cbhOffset.n) 示例 以下是代码 - import pandas as pd # 设置… 阅读更多

广告
© . All rights reserved.