SGU117

基于Android13的系统启动流程分析(三)之FirstStageMain阶段 init进程是Android系统中用户空间的第一个进程,作为第一个进程,它被赋予了很多极其重要的工作职责,比如创建zygote(孵化器)和属性服务等。init进程是由多个源文件共同组成的,这些文件位于源码目录system/core/init1. Bootloader 引导当按下设备电源键时,最先运行的就是 bootloader(固化在ROM的程序),bootloader 的主要作用就是硬件设备(如 CPU、flash、内存)的初始化并加载到RAM,通过建立内存空间映射,为装载 Linux 内核做好准备,。 阅读详情

题目大意:

给定n个数,求n个数中有多少个数它的m次方能被k整除

0<n,m,k<=10000


看到这种题就应该想到分解质因数……

把k分解质因数,然后把那n个数都分解质因数

乘方就变成指数的乘法

如果一个数每一项的指数>=k对应的项的指数,那么这个数的m次方可被k整除


快速幂应该也是可以过的……


//Lib
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<ctime>

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
using namespace std;
//Macro
#define rep(i,a,b) for(int i=a,tt=b;i<=tt;++i)
#define rrep(i,a,b) for(int i=a,tt=b;i>=tt;--i)
#define erep(i,e,x) for(int i=x;i;i=e[i].next)
#define irep(i,x) for(__typedef(x.begin()) i=x.begin();i!=x.end();i++)
#define read() (strtol(ipos,&ipos,10))
#define sqr(x) ((x)*(x))
#define pb push_back
#define PS system("pause");
typedef long long ll;
typedef pair<int,int> pii;
const int oo=~0U>>1;
const double inf=1e20;
const double eps=1e-6;
string name="",in=".in",out=".out";
//Var
int n,m,k;
int ori[10008],d[10008],prime[10008],f,g,x,cnt,ans;
int vis[10008];
void getprime(int n)
{
	rep(i,2,n)
	{
		if(!vis[i])prime[++cnt]=i,vis[i]=i;
		for(int j=1;j<=cnt&&prime[j]*i<=n;j++)
		{
			vis[i*prime[j]]=prime[j];
			if(i%prime[j]==0)break;
		}
	}
}
void divide(int x,int p[])
{
	rep(i,1,cnt)
	{
		while(x%prime[i]==0)x/=prime[i],p[i]++;
		if(x==1)break;
	}
}
void Work()
{
	scanf("%d%d%d",&n,&m,&k);
	divide(k,ori);
	rep(i,1,n)
	{
		scanf("%d",&x);
		memset(d,0,sizeof d);
		divide(x,d);bool flag=true;
		rep(i,1,cnt)
		{
			d[i]*=m;
			if(d[i]<ori[i]){flag=false;break;}
		}
		if(flag)ans++;
	}
	cout<<ans<<endl;
}
int main()
{
//	freopen((name+in).c_str(),"r",stdin);
//	freopen((name+out).c_str(),"w",stdout);
	getprime(10000);
	Work();
	return 0;
}


YOLOv8 更换损失函数DIoU、EIoU、GIoU...Inner-IoU... 介绍了一些损失函数,并将其应用到yolov8训练中 阅读详情

相关推荐

中文实体关系抽取数据集大盘点:从百度Duie2.0到医疗CBLUE,哪个更适合你的NLP项目?

本文全面分析了中文实体关系抽取领域的主流数据集,包括百度DuIE 2.0、医疗CBLUE等,帮助开发者根据项目需求选择最适合的数据集。文章详细对比了各数据集的特点、适用场景及优化策略,为自然语言处理项目提供实用指南。

weixin_29284657的博客 121

sgu117

SGU117 Counting 题目大意: 在给定的序列中找出M次方可以被K整除的数字个数。 输入: 第一行三个数N, M, K (0,N为序列个数,M、K如题。 输出: 满足题目条件的数字个数。 样例输入: 4 2 50 9 10 11 12 样例输出: 1 比较水啊。 快速幂分分钟过(好像暴力也可以)。 性质一:(a^m)%k=((a%k)^m)%k 性质

Tgop_Knight的专栏 702

从零开始用TS开发babylonjs - 本机环境搭建

babylonjs,初始化本地安装,web3d引擎

han3527638的专栏 794

SGU - 117 - Counting (快速幂取模!)

SGU - 117 Counting Time Limit: 250MS   Memory Limit: 4096KB   64bit IO Format: %I64d & %I64u Submit Status Description Find amount of numbers for given sequence of

Never say never 814

Starlink第三代终端和第二代终端的差异性有哪些?

starlink第三代终端和第二代终端的额差异

chen2jiang3的博客 2924

对10G/40Gphy中auto-negotiation功能调试

在近期有一个项目,是一台设备中发现mac与phy之间的信号质量有一些差,报文会出现很多的crc错误码。希望可以将mac与phy之间的工作模式改为10GBASE-KR/40GBASE-KR4,从而提高信号质量,减少crc错误码。要实现10GBASE-KR/40GBASE-KR4,需要打开auto-negotiation,所以,文章主要内容是如何开启自协商,以及相关参数的解释。 需要的文档: 1、802.3协议手册 2、所调试phy的芯片手册(我自己使用的是bcm的万兆phy) 万兆phy情况摘要 PHY寄存

MTzhang_22的博客 5829

SGU117—Counting (快速幂取模)

117. Counting time limit per test: 0.5 sec. memory limit per test: 4096 KB Find amount of numbers for given sequence of integer numbers such that after raising them to the M-th power they w

丙三醇 1634

从入门到实战:openEuler 系统管理与运维笔记(持续更新)

本文为openEuler系统管理与运维的实战笔记,从CentOS迁移者视角切入,详细介绍了openEuler的生态兼容性、内核优化及安全特性。内容涵盖系统安装规划、虚拟机部署、基础命令操作、文件系统管理以及用户权限配置等核心运维技能,旨在帮助读者快速上手并掌握这一企业级操作系统的日常管理。

weixin_29207149的博客 222

SGU 117 Counting(快速幂)

Description 给出三个整数n,m,k,以及n个数a[i],问这n个数中有多少个数满足a[i]^m%k=0 Input 第一行三个整数n,m,k,第二行n个整数a[i] (1<=n,m,k,a[i]<=10000) Output 输出n个数中满足a[i]^m%k=0的数的数量 Sample Input 4 2 50 9 10 11 12 Sample Output 1

ZSQ 549

Mac新手必看:为什么你的终端找不到Python命令?5分钟搞定zsh报错

本文针对Mac用户在终端遇到“zsh: command not found: python”报错的问题,提供了深度解析与实战修复指南。文章解释了macOS系统因历史原因默认使用`python3`而非`python`命令,并详细介绍了四种解决方案:养成使用`python3`的习惯、创建别名、通过Homebrew安装链接以及修改PATH环境变量,帮助新手快速解决zsh报错,顺利开始Python开发。

weixin_29248653的博客 594

十七、SAP-采购订单(STO)

业务逻辑、功能讲解、图文解析、章节总结

m0_72403327的博客 2067

SGU 117 Counting

SGU_117 直接应用快速幂取模即可。 #include<stdio.h>#include<string.h>int N, M, K;int pow_mod(int a, int n){ int ans; if(n == 1) return a % K; ans = pow_mod(a, n / 2); ans = a...

weixin_30888413的博客 100

[Research Tips] 我的zotero文献管理方案: 云端同步+iPad批注+overleaf笔记

文献管理一直是一个很头疼的事. 最初直接在paper上做笔记, 后来尝试各种各样的文献管理软件, 比如endnote, mendeley等, 再后来直接用excel. 每一种方案都不是很满意. 最近尝试了各种软件, 摸索出一个合适自己的文献管理方案, 分享给大家. 我的需求: 支持PDF内全文搜索. 支持笔记搜索. 支持同步 可以批注PDF. 支持word内引用 支持Tex笔记语法 支持标签化管理 目前的方案除了第二个需求, 其他的都支持. 就目前我的经验来说, 除了知网研学可以搜索笔记外, 其他软件都

落日之城 5316

【SGU】117. Counting 快速幂

传送门:【SGU】117. Counting 题目分析:kuai su

poursoul 757

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

SGU 117 Counting(快速幂|二分)

//SGU 117 Counting //二分 //by night_watcher #include #include using namespace std; #define ll long long ll m,k; ll pow(int a,int b){ if(b==1) return a%k; if(b%2==0){

716

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

SGU 117Counting(快速幂)

快速幂水题。 /********************** * author:crazy_石头 * Pro:SGU 117 * algorithm:quick pow * Time:0ms * Judge Status:Accepted ***********************/ #include #include #include #include using namespa

crazy_石头的专栏 987

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

SGU117 Counting

输入N个数,输出有多少个数的M次方可以被K整除

╮(╯▽╰)╭ 471

SGU 水题集3 SGU116 SGU117 SGU118 SGU119

我又推荐了四道大水题 SGU116 【dp+背包】 #include #include #define MAX 120005 int prime[1200]={1184,3,5,11,17,31,41,59,67,83,109,127,157,179,191,211,241,277,283,331,353,367,401,431,461,509,547,563,587,599,617,70

Prime21 1377

sgu 117

简单的数论题。   对于任意一个实数 M , 它可以表示成一些素数幂次的积,即:   P 为素数, 因此, 若 N的M次方能够整除K,则N的素数幂次乘以M后,均不小于K的素数幂次。 难度系数:☆☆☆☆☆ #include #include #include #include #include #include #include #include #include #in

HHYULARHH的专栏 429

SGU[117] Counting

Description 描述 Find amount of numbers for given sequence of integer numbers such that after raising them to theM-th power they will be divided byK. 求出给定一个包含N个整数的序列,其中某个数字的M次方能被K整除的数的个数。 ...

asd5215208的博客 122

SGU 117 Counting 数论

今天难得出太阳啊,真舒服~而且还是星期六~ 好吧~今天的最后一题,洗洗睡咯~ #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #ifdef _WIN32 #def

量子流逝 617

USB Type-C PD移动电源参考设计:从架构到实战全解析

USB Type-C接口凭借正反盲插和强大的USB PD协议,已成为消费电子产品默认的供电与通信端口。PD协议通过CC引脚协商电压电流,支持从5V到20V、最高100W的功率传输,并能兼容QC、AFC等主流快充协议,极大提升了设备的通用性。四开关升降压(Buck-Boost)拓扑作为核心功率变换方案,可在电池电压高于或低于输出电压时稳定工作,同时支持双向充放电,为移动电源、户外电源、电池供电开发板等产品提供了高效紧凑的设计路径。本文围绕一款完整的USB Type-C PD移动电源参考设计展开,涵盖系统架构、

weixin_33829657的博客 341

sgu 117 Counting

题目描述: 117. Counting time limit per test: 0.5 sec. memory limit per test: 4096 KB Find amount of numbers for given sequence of integer numbers such that after raising them to the M-th pow

utoppia is another word . 480

模拟/sgu 117 Index of super-prime

题意   给出n,m,k   接下来有n个数ai,求这些数中有多少个ai*m能被k整除   输出个数 分析   首先将k分解质因数,p[i]存的是第i个因子,num[p[i]]表示p[i]这个因子有多少个   将ai*m分解质因数,如果ai*m的质因数中,没有某个p[i],或质因数中某个p[i]的个数少于k中p[i]的个数(即num[p[i]]),那么,这个数就不符合要求   只有这...

weixin_30433075的博客 78
上一篇: [NOI2007]货币兑换Cash
下一篇: SGU118
OrpineX
博客等级 码龄17年 16粉丝 68原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值