The Luckiest number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 980 Accepted Submission(s): 301 Problem Description Chinese people think of '8' as the lucky digit. Bob also likes digit '8…
zhx's contest Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1867 Accepted Submission(s): 596 Problem Description As one of the most powerful brushes, zhx is required to give his juniors n p…
/* 矩阵乘法+快速幂. 一开始迷之题意.. 这个gcd有个规律. a b b c=a*x+b(x为常数). 然后要使b+c最小的话. 那x就等于1咯. 那么问题转化为求 a b b a+b 就是斐波那契了.... */ #include<iostream> #include<cstdio> #define MAXN 3 #define LL long long #define mod 1000000007 using namespace std; LL n; LL a[MAXN]…
Fermat's theorem states that for any prime number p and for any integer a > 1, ap = 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 base-a pseudoprimes,…
1202: GCD Time Limit: 1 Sec Memory Limit: 1280 MBSubmit: 201 Solved: 31[Submit][Status][Web Board] Description Input The first line is an positive integer T . (1<=T<= 10^3) indicates the number of test cases. In the next T lines, there are thre…
Sum Time Limit:1000MS Memory Limit:131072KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4704 Description Sample Input 2 Sample Output 2 Hint 1. For N = 2, S(1) = S(2) = 1. 2. The input file consists of multiple test cases. 题意…
import java.io.*; import java.math.*; import java.util.*; import java.text.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); BigInteger a, b, m, ans; while (cin.hasNext()) { ans = new BigInteger("1&…