2013年3月28日 星期四

20130329 專題

1.終於找到放音樂&button教學
努力英聽&照著做

https://www.youtube.com/watch?v=T1oJe-E0d9M

用了audiotoolbox


youtube 影片的截圖


2.後來發現聲音太小聲
於是找了

Audacity這款程式來放大聲音

http://audacity.sourceforge.net/

這邊是放大聲音的教學

http://www.inote.tw/2006/09/audacity-5.html

 

3. 現在想改變action 的EVENT

iOS控件的Sent Events的含义

http://blog.sina.com.cn/s/blog_67a5e4720100y0q3.html



--
希望未來會有滑動按button
跟程式一開始會設定一個音量的功能

不過目前要先畫介面
還要做透明button
還有其他音的輸出

20130328 專題

  今天因為什麼成果都沒有 呼攏了老師

回家之後打算發憤圖強

目前遇到的問題

1.介面要來學習個photoshop 之類的軟體



2.聲音檔
  目前用guitar pro 輸出了 MIDI

可是因為

--

OOO
心得:
如果要在ios播放音訊檔
可以用avfoundation或audiotoolbox這兩個framework
前者可以播大部分的音訊檔,但程式速度慢,適合音樂
後者只能播.caf .aif .wav格式的檔案,且不能超過30秒,適合音效

詳細使用方法請google
--
所以想辦法輸出 wav
但是用guitar pro 輸出 變成沒有聲音OR 雜訊

上網發現要:
照著實作之後發現自己就是沒有更新驅動程式那類的人
於是去更新驅動

GIGABYTE的下載中心打開前需要先把IE以系統管理員身分執行
否則好像會失敗

好不容易等了好久的自動下載安裝

一直0~100%跳

後來自己下載回來 
 重新開機



終於有了立體聲混音!!

也匯出了第一個wave檔 E0 (E弦沒按把位)

2013年3月24日 星期日

299 - Train Swapping

 Train Swapping 

At an old railway station, you may still encounter one of the last remaining ``train swappers''. A train swapper is an employee of the railroad, whose sole job it is to rearrange the carriages of trains.
Once the carriages are arranged in the optimal order, all the train driver has to do, is drop the carriages off, one by one, at the stations for which the load is meant.
The title ``train swapper'' stems from the first person who performed this task, at a station close to a railway bridge. Instead of opening up vertically, the bridge rotated around a pillar in the center of the river. After rotating the bridge 90 degrees, boats could pass left or right.
The first train swapper had discovered that the bridge could be operated with at most two carriages on it. By rotating the bridge 180 degrees, the carriages switched place, allowing him to rearrange the carriages (as a side effect, the carriages then faced the opposite direction, but train carriages can move either way, so who cares).
Now that almost all train swappers have died out, the railway company would like to automate their operation. Part of the program to be developed, is a routine which decides for a given train the least number of swaps of two adjacent carriages necessary to order the train. Your assignment is to create that routine.

Input Specification

The input contains on the first line the number of test cases (N). Each test case consists of two input lines. The first line of a test case contains an integer L, determining the length of the train ( tex2html_wrap_inline30 ). The second line of a test case contains a permutation of the numbers 1 through L, indicating the current order of the carriages. The carriages should be ordered such that carriage 1 comes first, then 2, etc. with carriage Lcoming last.

Output Specification

For each test case output the sentence: 'Optimal train swapping takes S swaps.' where S is an integer.

Example Input

3
3
1 3 2
4
4 3 2 1
2
2 1

Example Output

Optimal train swapping takes 1 swaps.
Optimal train swapping takes 6 swaps.
Optimal train swapping takes 1 swaps.
 
http://uva.onlinejudge.org/external/2/299.html
 
 
 
-- 
code: