STL 學習代碼~

#include<stdio.h>#include<numeric>#include<iostream>#include<functional>#include<algorithm>#include<vector>using namespace std;#define LL long long#define nmax 20int num[nmax];struct node {int x;};struct Add {int

hdu 3037 Saving Beans fzu 2020 組合 hit 2813 Garden visiting hrbeu 組合數 fzu 1564 Combination

組合數取餘P不是素數,P是素數1)P是素數Lucas theorem m = mk * p^k + mk-1 * p^k-1 +... +m1 * p + m0; n = nk * p^k + nk-1 * p^k-1 +... + n1 * p + n0; C(m,n)=C(mk,nk)*C(mk-1,nk-1)*...*C(m1,n1)*C(m0,n0); 【題目大意】 求C(n+m,n) % p的值。 保證p是素數。 C(m,n)%p=m!/(n!*(m-n)!)%p此時使用逆元,或擴充歐

hdu 2141 Can you find it? 二分

 /* * hdu2141.c * * Created on: 2011-10-9 * Author: bjfuwangzhu*/#include<stdio.h>#include<stdlib.h>#define nmax 5001#define nnum 250001#define LL long longLL numL[nmax], numN[nmax], numM[nmax], numLN[nnum];int cmp(const void *a,

hdu 3792 二分

/* * hdu3792.c * * Created on: 2011-9-19 * Author: bjfuwangzhu*/#include<stdio.h>#include<string.h>#define nmax 100200int prime[nmax], flag[nmax];int plen, nlen;typedef struct node {int i, value;} node;node Node[nmax];void init() {

sgu 193

import java.io.BufferedInputStream;import java.math.BigInteger;import java.util.Scanner;public class Main {public static void main(String[] args) { Scanner cin = new Scanner(new BufferedInputStream(System.in)); BigInteger num, two =

hdu 2899 Strange fuction 二分

  /* * hdu2899.c * * Created on: 2011-10-9 * Author: bjfuwangzhu*/#include<stdio.h>#include<math.h>#define eps 1.0e-8double ff(double x, double y) {return 42.0 * pow(x, 6.0) + 48.0 * pow(x, 5.0) + 21.0 * pow(x, 2.0) + 10.

zoj 1597 Circular Area

扇形面積=R*R*Hudu(扇形弧度)/2;弧長L=R*Hudu(扇形弧度) /* * zoj1597.c * * Created on: 2011-9-21 * Author: bjfuwangzhu*/#include<stdio.h>#include<math.h>#define pi acos(-1.0)#define eps 1.0e-8double distance(double x1, double y1, double x2, double

二分法 hrbeu 1211

思路:由於N<=10000

hdu 2643 Rank hdu 2512 一卡通大冒險 stirling (斯特靈數)的應用

hdu 2643/* 第二類Stirling數是把包含n個元素的集合劃分為正好k個非空子集的方法的數目。 遞推公式為: S(n,k) = 0(n<k||k=0), S(n,n) = S(n,1) = 1, S(n,k) = S(n-1,k-1) + kS(n-1,k). */#include<stdio.h>#define LL long long#define nmax 101#define nnum 20090126LLLL num[nmax][nmax],

hdu 2199 Can you solve this equation? 二分

 /* * hdu2199.c * * Created on: 2011-10-9 * Author: bjfuwangzhu*/#include<stdio.h>#include<math.h>#define eps 1.0e-10double f(double x) {return 8.0 * pow(x, 4.0) + 7.0 * pow(x, 3.0) + 2.0 * pow(x, 2.0) + 3 * x + 6;}void

求N的所有因子(約數)

#include<stdio.h>#include<math.h>#include<string.h>#include<stdlib.h>#define nmax 100000int prime[nmax], flag[nmax], factor[nmax], cfactor[nmax], divisor[nmax];int plen, flen, dlen;void init() { memset(flag, -1,

hdu 3711 Binary Number 位元運算(^ 與&)的應用

兩個數A和B異或的結果C就是他們二進位中相同的為0不同的為1,所以本題就是要數C的二進位中1的個數,而求一個數二進位中1的個數的方法很多,下面簡單介紹幾種:1.數C對2取餘,判斷餘數是不是為1,若是記錄一次,之後數C除以2,再進行前面的描述,知道數C為0,結束,代碼如下:int getBits(int n) {int res;res = 0;while (n) {if (n % 2 == 1) {res++;}n /= 2;}return res;}2.同上,不過對2取餘,採用&,除以2

hdu 1551 Cable master 二分

 /* * hdu1511.c * * Created on: 2011-10-9 * Author: bjfuwangzhu*/#include<stdio.h>#include<math.h>#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 < n; i++) {

幻方(zjut1005) 與 反幻方(hdu 3927)

zjut1005  做幻方此題是求解奇幻方記:關鍵是確定下一個數填的位置,規律是:1以後的每一個數只能填在它所在位置的下一行的下一列(記為A),如果A已經有數,就把下一個數填在當前這個數的上面(即與這個數同一列的上一個位置)#include<stdio.h>#include<string.h>#define nmax 101int num[nmax][nmax];int main() {#ifndef ONLINE_JUDGE freopen("data.in",

zoj 3175 Number of Containers

/* * zoj3175.c * * Created on: 2011-9-20 * Author: bjfuwangzhu*//* 題目描述:給定一個n,求1,2。。。n所有數的約數個數和f(n) 例如f(5)=10-5,f(4)=8-4 由於這個n非常大,故有兩種思考方向,第一種是找該函數的遞推或者公式,貌似很難而且每有頭緒 還有種思考的方式就是我們按段來統計,就是統計區間上有多少個數含有這個約數,我們是可以O(1)時間計算的

hdu 4038 Stone The 36th ACM/ICPC Asia Regional Chengdu Site —— Online Contest

在網友的提示之下,我終於AC了!唉,好慘呀!比賽快結束時,才有了一丁點的想法!唉!貼個代碼,請指教!!盡量多的3。對於負數,當有偶數個負數時,不必管它,若有奇數個負數,則將最大的負數盡量變為0,接著是使所有的0變為1,接著使所有的1變為2,接著使所有的2變為3。最後將剩餘的M變為3的X次方,此時M=M%3。若M=2,則要添加一個2,若是1,則要將正數中的最小數增加1,之後求積即可!/* * hdu4038.c * * Created on: 2011-9-11 * Author:

hdu 1969 Pie 二分

 /* * hdu1969.c * * Created on: 2011-10-9 * Author: bjfuwangzhu*/#include<stdio.h>#include<stdlib.h>#include<math.h>#define nmax 10010#define pi acos(-1.0)#define eps 1.0e-5double volume[nmax];int cmp(int n, double aver) {int

整數劃分 --- 一個老生長談的問題 動態規劃

整數劃分 --- 一個老生長談的問題:  1) 練練組合數學能力.  2) 練練遞迴思想  3) 練練DP  總之是一道經典的不能再經典的題目:  這道好題求:  1. 將n劃分成若干正整數之和的劃分數。  2. 將n劃分成k個正整數之和的劃分數。  3. 將n劃分成最大數不超過k的劃分數。  4. 將n劃分成若干奇正整數之和的劃分數。  5. 將n劃分成若干不同整數之和的劃分數。 1.將n劃分成不大於m的劃分法:    1).若是劃分多個整數可以存在相同的:    dp[n][m]=

勾股數

勾股數定理對於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。同時滿足這五條式的是一組勾股數,而且對於所有滿足這五條式的(x,y)乘一個k(k>=1),即(kx,ky)。就可以表示所有的勾股數,並且勾 股數和三元對(x,y,z)一一對應。換句話說,每個勾股數都只能表示為一個三元對(x,y,z)。並且z=1時,必須滿足c%4==1才能分出來。

數論小結–轉載

轉載於:http://blog.csdn.net/xieshimao/article/details/6425099斷斷續續的學習數論已經有一段時間了,學得也很雜,現在進行一些簡單的回顧和總結。學過的東西不能忘啊。。。 1、本原勾股數:概念:一個三元組(a,b,c),其中a,b,c沒有公因數而且滿足:a^2+b^2=c^2首先,這種本原勾股數的個數是無限的,而且構造的條件滿足:a=s*t,b=(s^2-t^2)/2,c=(s^2+t^2)/2其中s>t>=1是任意沒有公因數的奇數!由

總頁數: 61357 1 .... 9583 9584 9585 9586 9587 .... 61357 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.