原创 C++作業5.|最大公因數/反素數

Computing GCD Write a function to return greatest common dividers (GCDs) of 5 pairs of positive integer numbers.HINTTh

原创 C++作業9.|Matrix chain multiplication

Exercise 9.6 Matrix chain multiplication 矩陣鏈相乘,求最小的乘法次數 Given a sequence of matrices, we want to find the most

原创 C語言作業|螺旋方陣

#include <stdio.h> int main () { int n; scanf("%d",&n); int array[n][n], lu, rd, i, num = 1; /* lu is left/up, rd

原创 C語言模擬考|rectangles

Description Give you N rectangles.If you can pick exactly three pieces of those rectangles to form a larger rectangl

原创 Haskell作業1(1)|實現分數的常用運算(2)|計算平方根的Newton-Raphson公式

一、實現分數的常用運算 module MyFraction where import Test.QuickCheck import Prelude hiding ((<*>)) type Fraction = (Integer, In

原创 C語言模擬考|Proper Fraction

Description giving an integer N (2<=N<=20) and a real number M (0<M<=1), output all proper fractions whose numerator

原创 Haskell作業2(1)|畢達哥拉斯三元組

module MyTriads where triads :: Int -> [(Int,Int,Int)] triads n = [(x,y,z) | x <- [1..n] ,y <- [1..n], z <- [1..n], x^

原创 C語言模擬考|lower cases

Description Input a string which contains (a,b,c,...,z,A,B,C,...Z,\t and space ' ') and end of '\n',Please convert al

原创 C語言期中考|Code for ' ', a-z and A-Z

Description: Input a string, and then please output a series of number according to the following law. Law: ' ' -> 000

原创 Haskell作業2(2)|放大字符串

module MyPicture where import Data.Char import Data.List a1 = [" A "," A A ","A A ","AAAAA ","A A "] b1 =

原创 C語言模擬考|Counting

Description: Given an integer N, please count its reverse,how many digits in N,and then add all digits. Sample input:

原创 C語言模擬考|Maximal Discount

Description Linda is a shopaholic. Whenever there is a discount of the kind where you can buy three items and only p

原创 Haskell|Prelude 函數

Haskell Prelude 函數 轉載自 http://blog.sina.com.cn/s/blog_80da54b801018mb5.html 轉載自 http://hi.baidu.com/izhier/item/78f

原创 C語言/C++|Bubble Sort(冒泡排序)

C語言: #include <stdio.h> int main() { int n, i, j, temp; scanf("%d",&n); int array[n]; for (i = 0; i < n; ++ i) {

原创 Haskell筆記(11.16)|IO program

import System.IO -- 有副作用的函數類型 IO a, 其元素是完成一些動作,然後返回一個類型a的值的程序 -- putStr :: String -> IO () -- () :: () -- ↑值 ↑類型 {-