[Codeforces 933B]A Determined Cleanup】的更多相关文章

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}…
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…
传送门: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…
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…
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…
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…
A A Compatible Pair standard input/output 1 s, 256 MB    x1916 B A Prosperous Lot standard input/output 1 s, 256 MB    x3290 C A Twisty Movement standard input/output 1 s, 256 MB    x527 D A Determined Cleanup standard input/output 1 s, 256 MB    x19…
Codeforces Round #371 (Div. 2) A. Meeting of Old Friends |B. Filya and Homework A. Meeting of Old Friends  模拟 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> using namespace std; typedef long long ll;…