avatar
fireworks99
keep hungry keep foolish
sprintf

头文件

#include

作用之一

数字转字符串

Read more -->
JAVA 大数

条件判断: JAVA中while(n-- > 0)异于c++的while(n--)

Prepare to Input

Scanner in = new Scanner(System.in);//in可换为cin或scan
//......
in.close();//in可换cin或scan
Read more -->
POJ 2635 The Embarrassed Cryptographer

Description

The young and very promising cryptographer Odd Even has implemented the security module of a large system with thousands of users, which is now in use in his company. The cryptographic keys are created from the product of two primes, and are believed to be secure because there is no known method for factoring such a product effectively.

Read more -->
同余(模)定理

同余定义(德国/高斯):

两个整数 a、b,如果他们同时除以一个自然数p,所得的余数相同,则称a,b对于模p同余,记作a≡b(mod p)。读作:a同余于b模m。

Read more -->
POJ 3279 Fliptile

关于翻转问题

例:给定一个01串,现有翻转规则:

翻转某一个位置时其后面2个位置也会跟着翻转,也就是每次翻转都会翻转3个连续的位置。要将01串全部翻转为0,求最小的翻转次数

形似这类题的问题叫做翻转问题,也可以叫开关问题

Read more -->
尺取法

尺取法

尺取,取的是 : 多段等效区间(等效体现在:满足题目要求)

某些时候需要保证数列的单调性才能使用

Read more -->
异或寻异

关于异或

a为任意数字:

0 ^ a = a

a ^ a = 0

Read more -->
SDUT Balloons 和 HDU 1241 Oil Deposits

题目共同解法

都是求某一类连接成块共有多少块,那么对每一块dfs,运行多少次dfs便有多少块

Description

Both Saya and Kudo like balloons. One day, they heard that in the central park, there will be thousands of people fly balloons to pattern a big image. They were very interested about this event, and also curious about the image. Since there are too many balloons, it is very hard for them to compute anything they need. Can you help them? You can assume that the image is an N\N matrix, while each element can be either balloons or blank. Suppose element A and element B* are both balloons. They are connected if:

Read more -->
POJ 2449 Remmarguts' Date(第k短路)

Description

“Erenow, the princess sent Remmarguts a letter, informing him that she would come to the hall and hold commercial talks with UDF if and only if the prince go and meet her via the K-th shortest path. (in fact, Uyuw does not want to come at all)”

Read more -->
HDU 1874 畅通工程续

Dijkstra算法

主要特点是以起始点为中心向外层层扩展(广度优先搜索思想),直到扩展到终点为止。

主要思想是每次找到离”已成图“最近的一个顶点,然后将该顶点连入图,然后更新“已成图”到其他顶点的最短路径。贪心算法。

该算法要求图中不存在负权边!!!(无负权边自然无负权环)

Read more -->
Site by Baole Zhao | Powered by Hexo | theme PreciousJoy