A - Forgetting Things 题意:给 \(a,b\) 两个数字的开头数字(1~9),求使得等式 \(a=b-1\) 成立的一组 \(a,b\) ,无解输出-1. 题解:很显然只有 \(a=b\) 和 \(a=b-1\) 的时候有解,再加上一个从 \(9\) 越到 \(10\) 的就可以了.被样例的 \(199,200\) 误导了. #include<bits/stdc++.h> using namespace std; typedef long long ll; int mai…
链接: https://codeforces.com/contest/1247/problem/D 题意: You are given n positive integers a1,-,an, and an integer k≥2. Count the number of pairs i,j such that 1≤i<j≤n, and there exists an integer x such that ai⋅aj=xk. 思路: 对每个数质数拆分,记录质数的指数modk的值,map记录ve…
链接: https://codeforces.com/contest/1247/problem/C 题意: Vasya will fancy any number as long as it is an integer power of two. Petya, on the other hand, is very conservative and only likes a single integer p (which may be positive, negative, or zero). T…
链接: https://codeforces.com/contest/1247/problem/B2 题意: The only difference between easy and hard versions is constraints. The BerTV channel every day broadcasts one episode of one of the k TV shows. You know the schedule for the next n days: a sequen…
链接: https://codeforces.com/contest/1247/problem/A 题意: Kolya is very absent-minded. Today his math teacher asked him to solve a simple problem with the equation a+1=b with positive integers a and b, but Kolya forgot the numbers a and b. He does, howev…
F. Tree Factory Bytelandian Tree Factory produces trees for all kinds of industrial applications. You have been tasked with optimizing the production of a certain type of tree for an especially large and important order. The tree in question is a roo…
E. Rock Is Push You are at the top left cell (1,1) of an n×m labyrinth. Your goal is to get to the bottom right cell (n,m). You can only move right or down, one cell per step. Moving right from a cell (x,y) takes you to the cell (x,y+1), while moving…
B2. TV Subscriptions (Hard Version) The only difference between easy and hard versions is constraints. The BerTV channel every day broadcasts one episode of one of the k TV shows. You know the schedule for the next n days: a sequence of integers a1,a…
A. Forgetting Things Kolya is very absent-minded. Today his math teacher asked him to solve a simple problem with the equation…
D. Power Products You are given n positive integers a1,-,an, and an integer k≥2. Count the number of pairs i,j such that 1≤i<j≤n, and there exists an integer x such that ai⋅aj=xk. Input The first line contains two integers n and k (2≤n≤105, 2≤k≤100).…