• 题意:给你两个一元多项式\(f(x)\)和\(g(x)\),保证它们每一项的系数互质,让\(f(x)\)和\(g(x)\)相乘得到\(h(x)\),问\(h(x)\)是否有某一项系数不被\(p\)整除.

  • 题解:这题刚开始看了好久不知道怎么写,但仔细看题目给的条件可能会看出一点门道来,我们知道,\(c_{i}\)是由\(f(x)\)和\(g(x)\)中多个某两项积的和来得到的(\(c_{i}=a_{0}b{i}+a_{1}b_{i-1}+...+a_{i}b_{0}\)),那么我们只要找到第一个不被\(p\)整除的\(a_{i}\)和\(b_{i}\)即可.

  • 代码:

    int n,m;
    ll p;
    ll a[N],b[N]; int main() {
    ios::sync_with_stdio(false);cin.tie(0);
    cin>>n>>m>>p;
    for(int i=0;i<n;++i){
    cin>>a[i];
    }
    for(int i=0;i<m;++i){
    cin>>b[i];
    }
    int pos1=0;
    int pos2=0;
    for(int i=0;i<n;++i){
    if(a[i]%p!=0){
    pos1=i;
    break;
    }
    }
    for(int i=0;i<m;++i){
    if(b[i]%p!=0){
    pos2=i;
    break;
    }
    } cout<<pos1+pos2<<endl; return 0;
    }

CodeCraft-20 (Div. 2) C. Primitive Primes (数学)的更多相关文章

  1. Codeforce-CodeCraft-20 (Div. 2)-C. Primitive Primes(本原多项式+数学推导)

    It is Professor R's last class of his teaching career. Every time Professor R taught a class, he gav ...

  2. CF1316C Primitive Primes

    CF1316C [Primitive Primes] 给出两个多项式\(a_0+a_1x+a_2x^2+\dots +a_{n-1}x^{n-1}\)和\(b_0+b_1x+b_2x^2+ \dots ...

  3. S - Primitive Primes CodeForces - 1316C 数学

    数学题 在f(x)和g(x)的系数里找到第一个不是p的倍数的数,然后相加就是答案 为什么? 设x1为f(x)中第一个不是p的倍数的系数,x2为g(x)...... x1+x2前的系数为(a[x1+x2 ...

  4. Primitive Primes - 题解【数学】

    题面 It is Professor R's last class of his teaching career. Every time Professor R taught a class, he ...

  5. Codeforces Round #188 (Div. 2) C. Perfect Pair 数学

    B. Strings of Power Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/318/p ...

  6. Codeforces Round #376 (Div. 2) F. Video Cards 数学,前缀和

    F. Video Cards time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  7. Codeforces Round #337 (Div. 2) C. Harmony Analysis 数学

    C. Harmony Analysis   The semester is already ending, so Danil made an effort and decided to visit a ...

  8. Codeforces Round #320 (Div. 2) D. "Or" Game 数学

    D. "Or" Game time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  9. Codeforces Round #180 (Div. 2) C. Parity Game 数学

    C. Parity Game 题目连接: http://www.codeforces.com/contest/298/problem/C Description You are fishing wit ...

随机推荐

  1. 【Linux】linux的所有文件分类解析

    今天看书的时候,无意间看到/dev/文件夹,以前没注意,今天去看了下发现,很多文件的开头文件属性都是一些不怎么见到的 常见的是   -     这个是代表文件,可以vim编辑的 d     这个是代表 ...

  2. 【ORA】ORA-00371: not enough shared pool memory

    今天rac中有一个节点asm实例起不来包了ora-000371的错误,错误贴在下面: [oracle@rac2 dbs]$ srvctl start asm -n rac2 PRKS-1009 : F ...

  3. oralce move和shrink释放高水位

    转自:https://blog.51cto.com/fengfeng688/1955137 move和shrink的共同点: 收缩段,消除部分行迁移,消除空间碎片,使数据更紧密 shrink用法: 语 ...

  4. 阿里云VOD(三)

    一.视频播放器 参考文档:https://help.aliyun.com/document_detail/125570.html?spm=a2c4g.11186623.6.1083.1c53448bl ...

  5. 代码托管从业者 Git 指南

    本文作者:李博文 - CODING 后端开发工程师 前言 六七年前,我机缘巧合进入了代码托管行业,做过基于 Git 支持 SVN 客户端接入.Git 代码托管平台分布式.Git 代码托管读写分离.Gi ...

  6. FTP使用Socket SSL流程认证(一)

    关于Ftp使用SSL流程认证 本文章使用的是C#,ftp服务器为FileZilla 注:如果不是使用的Socket可以使用FtpWebRequst类,说实话,该类比较简单,但现在说的是SOCKET,网 ...

  7. linux通过ntp同步时间

    1.安装服务 yum install ntp ##安装ntp服务,这个和ntpdate不一样哦,用这个比较好 systemctl start ntpd.service ###启动服务 systemct ...

  8. Covering Indexes in MySQL, PostgreSQL, and MongoDB

    Covering Indexes in MySQL, PostgreSQL, and MongoDB - Orange Matter https://orangematter.solarwinds.c ...

  9. tarjan 复习笔记 割点与桥

    定义分析 给定一个无向连通图\(G=(V,E)\) 对于\(x\in Y\),如果删去\(x\)及与\(x\)相连的边后,\(G\)分裂为两个或者两个以上的不连通子图,那么称\(x\)为\(G\)的割 ...

  10. Elasticsearch如何保证数据不丢失?

    目录 如何保证数据写入过程中不丢 直接落盘的 translog 为什么不怕降低写入吞吐量? 如何保证已写数据在集群中不丢 in-memory buffer 总结 LSM Tree的详细介绍 参考资料 ...