Aladdin and the Flying Carpet (算术基本定理)

本文探讨了一个关于Aladdin使用神奇飞毯通过守卫的谜题。通过运用算术基本原理,我们找到了不同尺寸飞毯的可能性,并介绍了在一定范围内快速寻找素数的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

题目:

It’s said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first mystery.
Aladdin was about to enter to a magical cave, led by the evil sorcerer who disguised himself as Aladdin’s uncle, found a strange magical flying carpet at the entrance. There were some strange creatures guarding the entrance of the cave. Aladdin could run, but he knew that there was a high chance of getting caught. So, he decided to use the magical flying carpet. The carpet was rectangular shaped, but not square shaped. Aladdin took the carpet and with the help of it he passed the entrance.
Now you are given the area of the carpet and the length of the minimum possible side of the carpet, your task is to find how many types of carpets are possible. For example, the area of the carpet 12, and the minimum possible side of the carpet is 2, then there can be two types of carpets and their sides are: {2, 6} and {3, 4}.

1、我先直接分的,就感觉肯定没这么简单,果然tel了。。。
2、于是找答案,发现要用算术基本原理,自己真的什么都不懂= =

(1)一个大于1的正整数N,如果它的标准分解式为: 这里写图片描述
那么它的正因数个数为这里写图片描述

3、学到了在一定范围内找素数较快的方法,大概是要两个数组,一个用来记录哪些是素数(prim),一个用来判断(vis),就是先把vis初始化为0,将i从2开始,vis[2]是0,于是prim[0]=2,于是将2的倍数在vis中都变为1,3、5、7….可同理。总之就是去掉每个素数的倍数,剩下的一定是素数。ps.里面的c最后就是范围内的素数总个数,在之后还是有点用的

    ```
    void prime()
    { 
        memset(vis, 0, sizeof(vis));
        for(i=2; i<=maxn; i++){
            if(!vis[i]){
            prim[c++]=i;
            for(j=2*i; j<=maxn; j+=i)
                vis[j]=1;
            }
        }
    }
    ```

还有我必须表示一下,在写完这个提交后还re了两次,最后发现我把j+=i写成了j++,下次不能这样了啊!!!
4、最后用公式得到的是所有正因数的个数,所以要除2,还要去掉在1到给出的最小因数中出现的因数。

内容概要:本文介绍了奕斯伟科技集团基于RISC-V架构开发的EAM2011芯片及其应用研究。EAM2011是一款高性能实时控制芯片,支持160MHz主频和AI算法,符合汽车电子AEC-Q100 Grade 2和ASIL-B安全标准。文章详细描述了芯片的关键特性、配套软件开发套件(SDK)和集成开发环境(IDE),以及基于该芯片的ESWINEBP3901开发板的硬件资源和接口配置。文中提供了详细的代码示例,涵盖时钟配置、GPIO控制、ADC采样、CAN通信、PWM输出及RTOS任务创建等功能实现。此外,还介绍了硬件申领流程、技术资料获取渠道及开发建议,帮助开发者高效启动基于EAM2011芯片的开发工作。 适合人群:具备嵌入式系统开发经验的研发人员,特别是对RISC-V架构感兴趣的工程师和技术爱好者。 使用场景及目标:①了解EAM2011芯片的特性和应用场景,如智能汽车、智能家居和工业控制;②掌握基于EAM2011芯片的开发板和芯片的硬件资源和接口配置;③学习如何实现基本的外设驱动,如GPIO、ADC、CAN、PWM等;④通过RTOS任务创建示例,理解多任务处理和实时系统的实现。 其他说明:开发者可以根据实际需求扩展这些基础功能。建议优先掌握《EAM2011参考手册》中的关键外设寄存器配置方法,这对底层驱动开发至关重要。同时,注意硬件申领的时效性和替代方案,确保开发工作的顺利进行。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值