原创 藍橋杯 等腰三角形

本題目要求你在控制檯輸出一個由數字組成的等腰三角形。 具體的步驟是: 1. 先用1,2,3,...的自然數拼一個足夠長的串 2. 用這個串填充三角形的三條邊。從上方頂點開始,逆時針填充。 比如,當三角形高度是8時:        1  

原创 PAT甲級 1004.Counting Leaves (30)

A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no c

原创 迷宮問題(廣搜與深搜)

定義一個二維數組:  int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, };

原创 1015 Reversible Primes (20 分)

A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example i

原创 1007 Maximum Subsequence Sum(在線處理)

Given a sequence of K integers { N​1​​, N​2​​, ..., N​K​​ }. A continuous subsequence is defined to be { N​i​​, N​i+1​​

原创 2016年第七屆藍橋杯C/C++程序設計本科B組省賽 剪郵票

剪郵票 如【圖1.jpg】, 有12張連在一起的12生肖的郵票。 現在你要從中剪下5張來,要求必須是連着的。 (僅僅連接一個角不算相連) 比如,【圖2.jpg】,【圖3.jpg】中,粉紅色所示部分就是合格的剪取。   請你計算,一共有多

原创 Train Problem I

As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by

原创 Prime Ring Problem

A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and th

原创 Oil Deposits

The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with o

原创 Maze(dfs 回溯)

Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can g

原创 迷宮問題(廣搜)

定義一個二維數組:  int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, };

原创 ACboy needs your help again!

ACboy was kidnapped!!  he miss his mother very much and is very scare now.You can't image how dark the room he was put

原创 n皇后問題

在N*N的方格棋盤放置了N個皇后,使得它們不相互攻擊(即任意2個皇后不允許處在同一排,同一列,也不允許處在與棋盤邊框成45角的斜線上。 你的任務是,對於給定的N,求出有多少種合法的放置方法。 Input 共有若干行,每行一個正整數N≤

原创 Parentheses Balance

You are given a string consisting of parentheses () and []. A string of this type is said to be correct: (a) if it is t

原创 士兵隊列訓練問題

某部隊進行新兵隊列訓練,將新兵從一開始按順序依次編號,並排成一行橫隊,訓練的規則如下:從頭開始一至二報數,凡報到二的出列,剩下的向小序號方向靠攏,再從頭開始進行一至三報數,凡報到三的出列,剩下的向小序號方向靠攏,繼續從頭開始進行一至二報數