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

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…
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}…
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…
传送门: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…
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;…
Codeforces Round #346 (Div. 2)---E. New Reform E. New Reform time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Berland has n cities connected by m bidirectional roads. No road connects a city…
G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/problem/G Description An owner of a small company FacePalm has recently learned that the city authorities plan to offer to small businesses to partic…
Rock-Paper-Scissors 题目连接: http://codeforces.com/problemset/problem/173/A Description Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is play…
C. Freelancer's Dreams Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/605/problem/C Description Mikhail the Freelancer dreams of two things: to become a cool programmer and to buy a flat in Moscow. To become a cool pro…
D. Lazy Student Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/606/problem/D Description Student Vladislav came to his programming exam completely unprepared as usual. He got a question about some strange algorithm on a gr…
E. Brackets in Implications Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/550/problem/E Description Implication is a function of two logical arguments, its value is false if and only if the value of the first argument is…
C. Arthur and Table Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/problem/C Description Arthur has bought a beautiful big table into his new flat. When he came home, Arthur noticed that the new table is unstable. In t…
A. Even Odds Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/318/problem/A Description Being a nonconformist, Volodya is displeased with the current state of things, particularly with the order of natural numbers (natural n…
A. Wilbur and Swimming Pool Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/596/problem/A Description After making bad dives into swimming pools, Wilbur wants to build a swimming pool in the shape of a rectangle in his back…
B. The Monster and the Squirrel Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/592/problem/B Description Ari the monster always wakes up very early with the first ray of the sun and the first thing she does is feeding her…
Hall of Fame Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/attachments Description It was the second day of IBM Chill Zone, and it was the time for distributing the prizes. Unfortunately due to unknown reasons, the org…
G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/problem/G Description An owner of a small company FacePalm has recently learned that the city authorities plan to offer to small businesses to partic…
D. Zigzag time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output The court wizard Zigzag wants to become a famous mathematician. For that, he needs his own theorem, like the Cauchy theorem, or hi…
A. Winner time limit per test:1 second memory limit per test:64 megabytes input:standard input output:standard output The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of th…
C. Do you want a date? time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immedi…
 2017 JUST Programming Contest 2.0 题目链接:http://codeforces.com/gym/101343/problem/A A. On The Way to Lucky Plaza time limit per test:1.0 s memory limit per test:256 MB input:standard input output:standard output Alaa is on her last day in Singapore, s…
题目: http://codeforces.com/contest/1011/problem/D This is an interactive problem. Natasha is going to fly to Mars. Finally, Natasha sat in the rocket. She flies, flies... but gets bored. She wishes to arrive to Mars already! So she decides to find som…
A. Straight «A» 题面 Noora is a student of one famous high school. It's her final year in school - she is going to study in university next year. However, she has to get an «A» graduation certificate in order to apply to a prestigious one. In school, w…
A. Vitya in the Countryside 题目连接: http://codeforces.com/contest/719/problem/A Description Every summer Vitya comes to visit his grandmother in the countryside. This summer, he got a huge wart. Every grandma knows that one should treat warts when the…
D. Searching Rectangles 题目连接: http://codeforces.com/contest/714/problem/D Description Filya just learned new geometry object - rectangle. He is given a field consisting of n × n unit cells. Rows are numbered from bottom to top with integer from 1 to…