1015 Reversible Primes (20)(20 分)提问 A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also a prime. Now…
问n! 转化成k进制后的位数和尾数的0的个数.[UVA 10061 How many zeros and how many digits?] Given a decimal integer number you will have to find out how many trailing zeros will be there in its factorial in a given number system and also you will have to find how many di…
你万万想不到,Long Long 就能存下的数据 #include <iostream> #include <cstdio> #include <cstdlib> #include <map> using namespace std; typedef long long ll; map<char,int>mp; int main() { string s; while(cin>>s){ int max1=-1; int max2=-1…
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; ; char str[maxn]; int a[maxn]; int main() { int n, i, j, ans, t, tt, ttt, mod; scanf("%s", str); n = strlen(str); ans = ; j =…
1045 - Digits of Factorial Factorial of an integer is defined by the following function f(0) = 1 f(n) = f(n - 1) * n, if(n > 0) So, factorial of 5 is 120. But in different bases, the factorial may be different. For example, factorial of 5 in base 8 i…
A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also a prime. Now given any two positive integers N (&…
1019 General Palindromic Number (20 分) A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers. Althoug…
题目 A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also a prime. Now given any two positive integers N…
题目 3在十进制下满足若各位和能被3整除,则该数能被3整除. 5在十六进制下也满足此规律. 给定数字k,求多少进制(1e18进制范围内)下能满足此规律,找出一个即可,无则输出-1. 题解 写写画画能找到规律,即是求与k互质的数x,x进制下即能满足上述规律. 相关 求最大公约数:辗转相除法(又叫欧几里得算法) 欧几里德定理: gcd(a, b) = gcd(b , a mod b) ,对于正整数a.b. 其中a.b大小无所谓.当a值小于b值时,算法的下一次递归调用就能够将a和b的值交换过来. 代码…
Lucky Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 294 Accepted Submission(s): 49 Problem Description “Ladies and Gentlemen, It’s show time! ” “A thief is a creative artist who ta…