题目链接: http://codeforces.com/problemset/problem/919/E 题意: 让你求满足 \(na^n\equiv b \pmod p\) 的 \(n\) 的个数. \(2 ≤ p ≤ 10^{6} + 3, 1 ≤ a, b < p, 1 ≤ x ≤ 10^{12}\). 题解: 因为: $n \mod p $的循环节是 \(p\) \(a^{n} \mod p\)的循环节是 \(p-1\).(费马小定理) 所以: \(na^n \mod p​\)的循环节为…
E. Congruence Equation time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Given an integer x. Your task is to find out how many positive integers n (1 ≤ n ≤ x) satisfy where a, b, p are all k…
Supermarket 找最便宜的就行 Solution Perfect Number 暴力做 Solution Seat Arrangement 注意当k=1时,横着和竖着是同一种方案 Solution Substring dp[i][j]表示在节点i结束,字母j最多有多少个,按拓扑排序的顺序计算 Solution Congruence Equation Solution A Game With Numbers 跟SG游戏解决思路差不多 Solution…
原文链接http://www.cnblogs.com/zhouzhendong/p/8397685.html 2018-02-01 $A$ 题意概括 你要买$m$斤水果,现在有$n$个超市让你选择. 每个超市的水果价格是固定的.第$i$个超市的水果价格用两个整数$a_i和b_i$来表示.含义是$a_i$元可以买$b_i$斤. 问你买$m$斤水果最少花费多少钱. 题解 直接枚举超市,判断最少的花费就可以了. 代码 #include <cstring> #include <cstdio>…
Problem A:题目传送门 题目大意:给你N家店,每家店有不同的价格卖苹果,ai元bi斤,那么这家的苹果就是ai/bi元一斤,你要买M斤,问最少花多少元. 题解:贪心,找最小的ai/bi. #include <cstdio> using namespace std; double minn=2e9,x,y,M; int N; int read() { '); +c-'; return x; } inline double min(double x,double y){return x<…
A. Supermarket We often go to supermarkets to buy some fruits or vegetables, and on the tag there prints the price for a kilo. But in some supermarkets, when asked how much the items are, the clerk will say that a yuan for b kilos (You don't need to…
D. Substring time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output You are given a graph with n nodes and m directed edges. One lowercase letter is assigned to each node. We define a path's valu…
D. Substring time limit per test3 seconds memory limit per test256 megabytes Problem Description You are given a graph with n nodes and m directed edges. One lowercase letter is assigned to each node. We define a path's value as the number of the mos…
C. Seat Arrangements time limit per test1 second memory limit per test256 megabytes Problem Description Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that…
B. Perfect Number time limit per test2 seconds memory limit per test256 megabytes Problem Description We consider a positive integer perfect, if and only if the sum of its digits is exactly 10. Given a positive integer k, your task is to find the k-t…