与‘基础算法-枚举’有关的日志

uva1596

maksyuki 发表于 oj 分类,标签: ,
0
uva1596

In this problem, we consider a simple programming language that has only declarations of onedimensional integer arrays and assignment statements. The problem is to find a bug in the given program.

The syntax of this language is given in BNF as foll >>继续阅读

uva1595

maksyuki 发表于 oj 分类,标签:
0
uva1595

The figure shown on the left is left-right symmetric as it is possible to fold the sheet of paper along a vertical line, drawn as a dashed line, and to cut the figure into two identical halves. The figure on the right is not left-right symmetric as i >>继续阅读

uva1594

maksyuki 发表于 oj 分类,标签:
0
uva1594

A Ducci sequence is a sequence of n-tuples of integers. Given an n-tuple of integers (a1, a2, · · · , an), the next n-tuple in the sequence is formed by taking the absolute differences of neighboring integers:

(a1, a2, · · · , an) → (|a1 − a2|, |a2 >>继续阅读

uva1591

maksyuki 发表于 oj 分类,标签:
0
uva1591

Dr. Tuple is working on the new data-mining application for Advanced Commercial Merchandise Inc. One of the subroutines for this application works with two arrays P and Q containing N records of data each (records are numbered from 0 to N − 1). Array >>继续阅读

uva508

maksyuki 发表于 oj 分类,标签:
0
uva508

Samuel F. B. Morse is best known for the coding scheme that carries his name. Morse code is still used in international radio communication. The coding of text using Morse code is straightforward. Each character (case is insignificant) is translated >>继续阅读

uva253

maksyuki 发表于 oj 分类,标签:
0
uva253

We have a machine for painting cubes. It is supplied with three different colors: blue, red and green. Each face of the cube gets one of these colors. The cube’s faces are numbered as in Figure 1.

Since a cube has 6 faces, our machine can paint a f >>继续阅读

hdu1395

maksyuki 发表于 oj 分类,标签: ,
0
hdu1395

2^x mod n = 1

Problem Description

Give a number n, find the minimum x(x>0) that satisfies 2^x mod n = 1. >>继续阅读

uva10976

maksyuki 发表于 oj 分类,标签:
0
uva10976

It is easy to see that for every fraction in the form  (k > 0), we can always find two positive integers x and yx ≥ y, such that:

Now our question is: can you write a program that counts how many such pairs of x and y there are for any given  >>继续阅读