原创 UVA - 725 Division 【暴力枚舉】

Description #include <stdio.h> #include <string.h> int vd[10]; bool check(int a, int b){ int x; if (a

原创 ZOJ - 1107 FatMouse and Cheese 【DP記憶化搜索】【DFS】

Description FatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n: eac

原创 UVA - 673 Parentheses Balance 【棧】

Description #include <iostream> #include <cstdio> #include <stack> #include <cstring> using namespace std; int ma

原创 UVA - 489 Hangman Judge 【模擬】

Description #include <iostream> #include <cstdio> #include <cstring> using namespace std; int main() {

原创 UVA - 524 Prime Ring Problem

Description #include <cstdio> #include <cmath> using namespace std; int n, t = 0; int a[100] = {0}; int vis[50] =

原创 OpenJ_Bailian - 4013 中位數

Description 中位數定義:一組數據按從小到大的順序依次排列,處在中間位置的一個數或最中間兩個數據的平均值(如果這組數的個數爲奇數,則中位數爲位於中間位置的那個數;如果這組數的個數爲偶數,則中位數是位於中間位置的兩個數的平均值)

原创 OpenJ_Bailian - 3708 1的個數 【進制轉換】

Description 給定一個十進制整數N,求其對應2進制數中1的個數 Input 第一個整數表示有N組測試數據,其後N行是對應的測試數據,每行爲一個整數。 Output N行,每行輸出對應一個輸入。 Sample Inpu

原创 OpenJ_Bailian - 4070 全排列

Description 對於數組[1, 2, 3],他們按照從小到大的全排列是 1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1 現在給你一個正整數n,n小於8,輸出數組[1, 2, …,n]的從小到大的全排列。

原创 UVA - 514 Rails

Description #include <cstdio> using namespace std; int a[1005] = {0}, b[1005] = {0}; int main() { int i,

原创 UVA - 536 Tree Recovery

Description #include <cstdio> #include <cstring> using namespace std; void postorder(int len, char *pr, char *i

原创 UVA - 1586 Molar mass 【字符串處理】

Description Input Your program is to read from standard input. The input consists of T test cases. The number of te

原创 UVA - 1640 The Counting Problem

Description Given two integers a and b, we write the numbers between a and b, inclusive, in a list. Your task is to ca

原创 HRBUST - 1569 比賽排名

Description 有n個同學參加了一場比賽,每個同學都有一個確定的名字。 並且每個人都一個得分,但可能由於一些犯規導致扣分,所以最終的實際得分爲總得分減去犯規扣分。 如一個人得分爲100,扣分爲10,那麼實際得分爲90。 現在需要

原创 ZOJ - 2109 FatMouse' Trade 【貪心】【揹包】

Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his

原创 HihoCoder - 1704 循環數組

Description 給定包含N個整數的數組A1, A2, ... AN,你可以選擇任意一個Ai,將Ai旋轉到數組第一項,即將數組變成: Ai, Ai+1, Ai+2, ... AN, A1, A2, ..., Ai-1   現在小H