Codeforces 934.D A Determined Cleanup】的更多相关文章

D. A Determined Cleanup time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In order to put away old things and welcome a fresh new year, a thorough cleaning of the house is a must. Little Tomm…
传送门:http://codeforces.com/contest/934/problem/D 给定两个正整数p(p≥1).k(k>1).多项式f(x)的系数的取值集合为{0,1,2,...,k-1},且存在多项式q(x),s.t.f(x)=q(x)·(x+k)+p.求多项式f(x). 设$f(x)=\sum_{i=0}^{n}a_i x^i$,$q(x)=\sum_{i=0}^{n-1}b_i x^i$,则:$f(x)=q(x)\cdot(x+k)+p=kb_0+p+\sum_{i=1}^{n…
934D - A Determined Cleanup 思路: 找规律,和k进制的求法差不多,答案的奇数位是p%k,偶数位如果p%k!=0,那么答案是k-p%k,否则为0. 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mem(a,b) memset(a,b,sizeof(a)) ; vector<int>ans; int main…
D. A Determined Cleanup time limit per test1 second memory limit per test256 megabytes Problem Description In order to put away old things and welcome a fresh new year, a thorough cleaning of the house is a must. Little Tommy finds an old polynomial…
[codeforces934D]A Determined Cleanup 试题描述 In order to put away old things and welcome a fresh new year, a thorough cleaning of the house is a must. Little Tommy finds an old polynomial and cleaned it up by taking it modulo another. But now he regrets…
Description 题库链接 给你两个正整数 \(p,k\) ,询问是否能够构造多项式 \(f(x)=\sum\limits_{i=0}^{d-1}a_ix^i\) ,使得存在多项式 \(q(x)\) ,满足 \(f(x)=q(x)\cdot(x+k)+p\) .且 \(a_i\in[0,k),i\in [0,d)\) . \(1\leq p\leq 10^{18},2\leq k\leq 2000\) Solution 我们假设 \(q(x)=\sum\limits_{i=0}^{d-2}…
A. Love Triangle time limit per test1 second memory limit per test256 megabytes Problem Description As you could know there are no male planes nor female planes. However, each plane on Earth likes some other plane. There are n planes on Earth, number…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 设\(设f(x)=a_d*x^{d}+a_{d-1}*x^{d-1}+...+a_1*x+a_0\) 用它去除x+k 用多项式除法除一下就好. 会发现余数等于 \(∑_0^{d}(-k)^{i}*a_i\) 这是一个十进制数转成负k进制数的和的形式. 而p已知. 问题就转化为把十进制数p转成-k进制数的问题了. [代码] #include <bits/stdc++.h> #define ll long long using n…
http://codeforces.com/contest/934 A. A Compatible Pair   time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Nian is a monster which lives deep in the oceans. Once a year, it shows up on the la…
C. A Twisty Movement time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clot…