RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-546912

pechenb's questions

Martin Hope
pechenb
Asked: 2024-09-01 01:47:22 +0000 UTC

“time.monotonic()”函数操作中的奇怪之处

  • 6

我正在学习Python课程,我了解了这样的功能time.monotonic():每次启动程序时,函数返回的两个值之间的差异应该是固定的。但我没有注意到类似的事情。

import time
st = time.monotonic()
time.sleep(1)
end = time.monotonic()
print(end - st)

上面的代码每次运行时都会输出完全不同的数字。我错过了什么吗?我使用 macOS 12、Zed 代码编辑器、Python 3.12.5

python
  • 1 个回答
  • 27 Views
Martin Hope
pechenb
Asked: 2024-06-17 23:57:14 +0000 UTC

如果 ubuntu 在虚拟机中正常工作,它能否作为成熟的操作系统正常工作?

  • 5

在 Virtual Box 上安装了 Ubuntu 24.04。我检查过:有声音,控制装置反应灵敏等等。也就是说,汽车按其应有的方式工作。我的设备是华为MateBook D15。

这是否意味着当我将 ubuntu 安装为完整操作系统时,它将像虚拟机一样在我的设备上运行?

linux
  • 1 个回答
  • 40 Views
Martin Hope
pechenb
Asked: 2023-10-21 02:49:37 +0000 UTC

限制 Replace C# 方法中的替换次数

  • 5

C#:程序应替换子字符串 1 次。

string s = new string('1', 45) + new string('2', 45);
while (s.Contains("111"))
{
    s = s.Replace("111", "2");
    s = s.Replace("222", "1");
}
Console.WriteLine(s);

21

Python:

s = '1' * 45 + '2' * 45 
while '111' in s:
    s = s.replace('111', '2', 1)
    s = s.replace('222', '1', 1)
print(s)

12

c#
  • 1 个回答
  • 57 Views
Martin Hope
pechenb
Asked: 2023-10-19 22:15:52 +0000 UTC

如何将字符串紧凑地转换为整数值数组?

  • 5

我知道您可以在循环中执行此操作,但我需要一种不必编写代码块的方法。我们需要最紧凑的录制选项。

string s = "23 43 65 2323 66";
int[] ints =  // {23, 43, 65, 2323, 66};
c#
  • 1 个回答
  • 93 Views
Martin Hope
pechenb
Asked: 2023-05-10 01:17:57 +0000 UTC

来自 C# 中的 python itertools 的产品模拟

  • 7

我的代码遍历 5 个字符长的单词中 ABC 字符的所有可能组合,并打印出它们的数量。如何在 C# 中编写此代码?

from itertools import product
combinations = product("ABC", repeat=5)
count = 0
for i in combinations:
    count += 1
print(count)
python
  • 1 个回答
  • 36 Views
Martin Hope
pechenb
Asked: 2023-05-01 17:42:58 +0000 UTC

统计一个大数的二进制表示法中1的个数

  • 5

任务:表达式值的二进制表示法中包含多少个单位:4^2020 + 2^2017 - 15?

因为数字大于允许的双精度值,所以我的程序输出错误答案:vr = infinity, count = 1。(count 必须是 2015)

    double vr = Math.Pow(4, 2020) + Math.Pow(2, 2017) - 15; // наше выражение
    string b = Convert.ToString((int)vr, 2);
    int count = 0; //счётчик единиц
    for (int i = 0; i < b.Length; i++)
    {
        if (b[i] == '1')
        {
            count++;
        }
    }
    Console.WriteLine(count);
c#
  • 2 个回答
  • 54 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5