原创 Codeforces Round #376 (Div. 2)

A - Night at the Museum Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status

原创 HDU 1222 Wolf and Rabbit(gcd)

Description There is a hill with n holes around. The holes are signed from 0 to n-1.  A rabbit must hide in one of

原创 Poj 1269 Intersecting Lines

Description We all know that a pair of distinct points on a plane defines a line and that a pair of lines on a pla

原创 Poj 3304 Segments

Description Given n segments in the two dimensional space, write a program, which determines if there exists a lin

原创 Poj 1067 取石子游戲

Description 有兩堆石子,數量任意,可以不同。遊戲開始由兩個人輪流取石子。遊戲規定,每次有兩種不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在兩堆中同時取走相同數量的石子。最後把石子全部取完者爲勝者。現在給

原创 Poj 1654 Area

Description You are going to compute the area of a special kind of polygon. One vertex of the polygon is the origi

原创 COJ 1010 [001]質因數分解 [EASY]

[001]質因數分解 [EASY] Time Limit: 1000 ms     Memory Limit: 65536 KB Total Submit: 1891     Accepted: 582  Description

原创 POJ 2262 Goldbach's Conjecture(素數)

Description In 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in whi

原创 HDU 2602 Bone Collector(01揹包)

Description Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to

原创 歐幾里德與擴展歐幾里德算法

歐幾里德算法(輾轉相除法) 可用於計算兩個整數a,b的公約數和公倍數 定理:gcd(a, b) = gcd(b , a%b) int gcd(int a,int b) { return b ? gcd(b,a%b):a; } 最小公

原创 5-38 數列求和-加強版 (20分)

#include <iostream> #include <stdio.h> #include <algorithm> using namespace std; int a[10000020]= {0}; int main() {

原创 POJ 3624 Charm Bracelet (01揹包)

Description Bessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill

原创 取(2堆)石子游戲

Description 有兩堆石子,數量任意,可以不同。遊戲開始由兩個人輪流取石子。遊戲規定,每次有兩種不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在兩堆中同時取走相同數量的石子。最後把石子全部取完者爲勝者。現在給