HDU 3049 Data Processing

P is a prime number, so there are: (1). A/B % P = (a % (B * p)/B) % P; (2). A/B % P = A * (B ') % P where B' is the inverse element of B for P Method 1: # include int main () {int I, t, x, V = 1, n, m, ans; long P, A [51000], sum; scanf ("% d",

Select, insert, and bubble sort (from small to large)

Package COM. wangzhu. main; public class main {/*** @ Param ARGs */public static void main (string [] ARGs) {work (New int [] {1, 1, 1, 1, 1}); Work (New int [] {5, 4, 3, 2, 1}); Work (New int [] {1, 2, 3, 4, 5}); Work (New int [] {1, 7, 2, 3, 3, 4,

Whether the sum of several numbers in a group is equal to the known number

1. Whether the sum of two numbers is equal to the known number (key. A: exhaustive: select two numbers in the array to determine whether the number is equal to the known number and the complexity is O (n ^ 2 ). B: Binary: first sort (not required

Membership statement in the class template

There are three types of membership declarations that can appear in the class template:1. Non-template friends or friends Functions The Foo () member functions bar () and foobar classes are the friends of all instances of the queueitem class

Multi-inherited member access

The compiler first analyzes the instance to which a name should be used, and then checks whether the access permission of the instance is valid. # Include Class base1 {Public://...Protected:Int ival;Double dval;Char cval;//...PRIVATE:Int * ID;//...}

Two conditions for template function parameters to be specified

1. When the parameter deduction fails, ambiguous is generated. You can understand the specified parameter. Min5 (dobj, fobj );2. When the compiler cannot push the returned type Template T1 sum (T2, T3 ); When a parameter is specified, only

Significance of the explicit Constructor

In a class constructor, Any constructor with only one parameter defines a set of implicit conversions to convert the parameter type of the constructor to the type of the class; For example: Smallint (INT) converts an int value to a smallint value;

HDU 1551 cable master binary

  /* * hdu1511.c * * Created on: 2011-10-9 * Author: bjfuwangzhu*/#include#include#define eps 1.0e-8#define nmax 10001double num[nmax];int cmp(int n, double aver) {int i, temp;for (i = 0, temp = 0; i temp += (int) (num[i] / aver);

HDU 1969 pie binary

  /* * hdu1969.c * * Created on: 2011-10-9 * Author: bjfuwangzhu*/#include#include#include#define nmax 10010#define pi acos(-1.0)#define eps 1.0e-5double volume[nmax];int cmp(int n, double aver) {int i, temp;for (i = 0, temp = 0; i

Number of Shares

Theorem of number of sharesFor a ^ 2 + B ^ 2 = C ^ 21. A = x ^ 2-y ^ 22. B = 2 * x * y3. c = x ^ 2 + y ^ 24. gcd (x, y) = 1.5. gcd (a, B, c) = 1.At the same time, the five formulas are satisfied with a group of shares, and all (x, y) satisfying

HDU 2141 can you find it? Binary

  /* * hdu2141.c * * Created on: 2011-10-9 * Author: bjfuwangzhu*/#include#include#define nmax 5001#define nnum 250001#define LL long longLL numL[nmax], numN[nmax], numM[nmax], numLN[nnum];int cmp(const void *a, const void *b) { LL temp = *(

Evaluate all factors of N (approx)

#include#include#include#include#define nmax 100000int prime[nmax], flag[nmax], factor[nmax], cfactor[nmax], divisor[nmax];int plen, flen, dlen;void init() { memset(flag, -1, sizeof(flag));int i, j;for (i = 2, plen = 0; i if (flag[i]) {

HDU 4038 stone the 36th ACM/ICPC Asia Regional Chengdu site -- online contest

At the prompt of a netizen, I finally AC! Alas, it's so miserable! When the competition was over, I had a little bit of thought! Alas! Post a code. Please advise !! 3 as much as possible. For a negative number, when there is an even number of

Judge whether an integer is a small solution with an odd number.

Use n % 2 = 1 to determine whether it is an odd number: Import Java. io. bufferedinputstream; import Java. util. extends; public class main {/*** @ Param ARGs */public static void main (string [] ARGs) {int A; using CIN = new using (New

Hrbeu combination number logarithm Remainder

Question link: http://acm.hrbeu.edu.cn/index.php? Act = problem & id = 1010 & cid = 25 P is a non-prime number, so there are: Convert C (n, m) % P = P0 ^ C0 ''' PI ^ CI % P #include#include#define LL long long#define nmax 100001int flag[nmax], prime[

Fafu 1079 helps Donger to combine the number of included factors

For the Factor M in this question, you only need to convert it into the product form of the prime factor, where the number of each prime factor is Mi, then, you only need to obtain the number Ci of each prime factor PI in the number of combinations,

HDU 2065 "red virus" problem exponential functions

Note: (1 + x/1! + X ^ 2/2! + ''+ X ^ n/n !) ^ 2*(1 + x ^ 2/2! + ''') ^ 2 From e ^ x = 1 + x/1! + X ^ 2/2! + ''' Original formula = e ^ (2 * X) * (E ^ x + e ^ (-x)/2) ^ 2 = (1/4) * (E ^ (2 * x) + 1) ^ 2 = (1/4) * (E ^ (4 * x) + 2 * E ^ (2 * x) + 1) =

HDU 3826 squarefree Number Theory

#include#include#include#define nmax 1000001int prime[nmax], plen;void init() {memset(prime, -1, sizeof(prime));int i, j;for (i = 2; i The following is reproduced in: Http://hi.baidu.com/304467594/blog/item/f02407ea9eeecac62f2e2136.html /*Determine

HDU 1521 permutation and combination of exponential functions

  /** Hdu1521.c** Created on: 2011-8-31* Author: Wang Zhu*/# Include # Include # Define Nmax 15Int num [Nmax];Double res [Nmax], FAC [Nmax], temp [Nmax];Void Init (int n ){Int I;FAC [0] = 1;For (I = 1; I FAC [I] = FAC [I-1] * I;}}Int main (){#

PKU 2480 longge's problem maximum common approx sum

Practice:I can't find it.Only considering that there are CI m for gcd (m, n) = I. The answer to this formula is Σ (CI * I)Gcd (m, n) = I gcd (M/I, n/I) = 1Find the number of M/I in gcd (M/I, n/I) = 1, which is the definition of Euler's function PHI

Total Pages: 64722 1 .... 55398 55399 55400 55401 55402 .... 64722 Go to: GO

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.