Codeforces Numbers 题解】的更多相关文章

这题只需要会10转P进制就行了. PS:答案需要约分,可以直接用c++自带函数__gcd(x,y). 洛谷网址 Codeforces网址 Code(C++): #include<bits/stdc++.h> using namespace std; int jz(int x,int p) { ,a; ) {//10转P进制 a=x%p; s+=a;//直接将算出的哪一位加上 x/=p; } return s; } int main() { ; cin>>A; ; ;i<A;i…
CodeForces#536 A. Lunar New Year and Cross Counting Description: Lunar New Year is approaching, and you bought a matrix with lots of "crosses". This matrix \(M\) of size \(n \times n\) contains only 'X' and '.' (without quotes). The element in t…
题面 传送门:http://codeforces.com/problemset/problem/840/C C. On the Bench time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output A year ago on the bench in public park Leha found an array of n numbers. L…
题目 Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if and only if it is divisible by each of its nonzero digits. We will not argue with this and just count the quantity of beautiful…
Problem Description Fermat's theorem states that for any prime number p and for any integer a > 1, a^p == a (mod p). That is, if we raise a to the pth power and divide by p, the remainder is a. Some (but not very many) non-prime values of p, known as…
Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first 20 humble numbers. Write a program to find and pri…
12.18 update:补充了 $ F $ 题的题解 A 题: 题目保证一定有解,就可以考虑用 $ 2 $ 和 $ 3 $ 来凑出这个数 $ n $ 如果 $ n $ 是偶数,我们用 $ n / 2 $ 个 $ 2 $ 来凑出 $ n $ 即可 如果 $ n $ 是奇数,就用 $ n / 2 - 1 $ 个 $ 2 $ 和 $ 1 $ 个 $ 3 $ 凑出 $ n $ 即可 所以只需输出 $ n / 2 $ B 题: 如果一个字符串重排后一定是回文串,说明这个字符串只有 $ 1 $ 种字符 如…
Add Two Numbers: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You may assum…
Raising Modulo Numbers Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6347   Accepted: 3740 Description People are different. Some secretly read magazines full of interesting girls' pictures, others create an A-bomb in their cellar, oth…
https://vjudge.net/problem/CodeForces-359D http://codeforces.com/problemset/problem/359/D 题目大意: 给一串数,问一个区间内所有的数是否能被其其中一个数所全部整除,求出满足条件的区间的长度最大值,并输出这样的区间的个数与它们的左端点. 换句话将,求区间GCD=区间MIN的最大长度区间. 明显st表解决. 对于最大区间长度,二分判断即可. (因为在poj做过类似的题所以思路能很快……就是题看不懂有点难,所以特…