RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

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

全部问题

Martin Hope
Yuri
Asked: 2020-08-26 17:55:55 +0000 UTC

如何了解浏览器对 CSS 属性的支持?

  • 11

我想制作一个在大多数浏览器中看起来都正确的网站。但是在创作的路上,遇到了跨浏览器兼容的问题。也就是说,一个浏览器支持这个 CSS,而另一个不支持。

我如何知道给定的浏览器是否支持指定的 CSS 属性?是否有可能在一个 CSS 中知道这一点?

javascript
  • 2 个回答
  • 10 Views
Martin Hope
nick_gabpe
Asked: 2020-08-23 01:57:48 +0000 UTC

如何同时写入标准输出和文件?

  • 11

有一个python脚本:

import sys
sys.stdout = open('my_log.log', 'w')
print 'test'

它将所有标准输出写入文件。问题:如何同时写入文件并输出到控制台?

python
  • 4 个回答
  • 10 Views
Martin Hope
Cus
Asked: 2020-08-17 23:54:52 +0000 UTC

是否可以在没有 root 权限的情况下安装库?

  • 11

我需要安装libjansson库。使用root权限,我将输入:

apt-get install libjansson-dev

但我没有root权限。是否可以在没有root
权限 的情况下安装此库?

如果可能,请举例说明(应该做什么)。

c++
  • 3 个回答
  • 10 Views
Martin Hope
V.March
Asked: 2020-08-15 02:42:00 +0000 UTC

最大回文数是两个素数五位数的乘积

  • 11

我根据一家公司的TK提出了申请。我做了一个android应用程序,在模拟器上得到了结果,似乎是正确的。但是 HR 只是取消订阅我的申请给出的答案不正确。
Aychars 是很忙的人,所以很少有人能指出错误,拒绝后被强加于人是一项非常吃力不讨好的任务。但是,我还是想至少为自己完成任务到最后。

要求是:

编写一个程序,返回最大的回文数,它是两个五位素数的乘积,并返回因子本身。
素数是只能被 1 和自身整除的自然数 (2, 3, 5, 7, 11, ...)
回文是在两个方向上读取相同的字符串(例如 ABBA)

我很清楚找到素数的原理。使用数组是不切实际的,因为必须丢弃 Eratosthenes 的筛子及其类似物——为如此多的值创建一个数组会占用大量内存。

这就是为什么我决定使用循环进行匹配和过滤。

这是我的android应用程序代码:

主要活动:

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private int maxNum = 99999;
    private int minNum = 10000;

    private int divNumMax = 0;
    private int palind;

    private TextView tv1;
    private TextView tv2;
    private TextView tv3;
    private TextView tv4;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        tv1 = (TextView) findViewById(R.id.textView1);
        tv2 = (TextView) findViewById(R.id.textView2);
        tv3 = (TextView) findViewById(R.id.textView3);
        tv4 = (TextView) findViewById(R.id.textView4);

        Button btnStart = (Button) findViewById(R.id.button);
        btnStart.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {

        divNumMax = (int) Math.sqrt(maxNum);

        int fPM;
        int sPM;
        boolean isNotPalind;

        fPM = findMaxPrimeNumber(maxNum);
        sPM = findMaxPrimeNumber(fPM - 2);
        isNotPalind = findPalindrome(fPM, sPM);

        while (isNotPalind) {

            if (sPM <= fPM && sPM > minNum) {
                sPM = findMaxPrimeNumber(sPM - 2);
                isNotPalind = findPalindrome(fPM, sPM);

            } else if (sPM <= minNum) {
                fPM = findMaxPrimeNumber(fPM - 2);
                sPM = fPM;
            }

            tv2.setText("1-st primary number: " + fPM);
            tv3.setText("2-nd primary number: " + sPM);
            tv4.setText("1-st * 2-nd = " + palind);

        }
    }


    private int findMaxPrimeNumber(int maxNumPre) {
        int i;
        int j;
        int z;
        int maxNumNew;

        for (i = maxNumPre; i >= minNum; i = i - 2) {

            for (j = 3; j <= divNumMax; j++) {

                z = i % j;

                if (z == 0 && j <= divNumMax) {
                    break;

                } else if (z != 0 && j == divNumMax) {
                    maxNumNew = i;
                    return maxNumNew;

                }
            }

        }
        return 10000;
    }


    private boolean findPalindrome(int firstPrime, int secondPrime) {

        int resultOfMath = firstPrime * secondPrime;

        String ltrResult = Integer.toString(resultOfMath);
        String rtlResult = new StringBuffer(ltrResult).reverse().toString();

        if (ltrResult.equals(rtlResult)) {

            palind = resultOfMath;
            return false;

        } else {
            return true;
        }
    }
}

模拟器上的结果截图:

在此处输入图像描述

我在我犯了错误的地方挠头,我错过了什么。我不要求你为我做TK,但我不想留下一些未解决的问题。

android
  • 5 个回答
  • 10 Views
Martin Hope
Игорь Ага
Asked: 2020-08-03 18:02:56 +0000 UTC

弯曲的进度条 c# WPF

  • 11

大佬们,告诉我如何制作一个半圆形的进度条?与往常一样,根本没有问题。我发现只有痛苦复杂的圆形例子在此处输入图像描述

c#
  • 1 个回答
  • 10 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