自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(30)
  • 资源 (1)
  • 收藏
  • 关注

原创 vim + syntastic + verilator or iverilog

若文章有錯誤請留言指證 需要轉載請通知筆者syntastic讓你可以在vim裡可以使用lint功能,讓你在寫code時檢查看看有沒有語法上的錯誤或者可能潛在的錯誤這裡我是透過vundle安裝syntastic,如果不會使用vundle,請參考官方Installlinter首先要先安裝linter有兩種選擇: Icarus Verilog或是verilator,看你偏好哪一種 我是經由hom

2016-10-25 16:33:50 1986 1

原创 UVA 455 Periodic Strings

Problemhttps://uva.onlinejudge.org/external/4/455.pdfThinking使用窮舉法, 先測測看cycle=1合不合法在測2測3…測到跟字串一樣長為止, 若有重複的cycle取最小Solution#include<iostream>#include<string>using namespace std;bool isMatch(int cycle

2016-09-02 15:56:31 397

原创 UVA 10340 All in All

Problemhttps://uva.onlinejudge.org/external/103/10340.pdfThinking其實只是在t字串裡有沒有s字串裡的所有字母, 且順序關係要和s一樣 比如說: 1. t = abcde s = abe 是合法的 2. t = abcde s = dc 就不合法 雖然t字串裡有s的所有字母,但是順序關係不同Solution#include<

2016-09-02 13:39:37 486

原创 UVA 202 Repeating Decimals

Problemhttps://uva.onlinejudge.org/external/2/202.pdfThinking直式除法(詳細TODO)Solution#include<iostream>#include<cstdio>#include<string>using namespace std;void solve(int a,int b){ int marked[3005] =

2016-09-02 12:46:20 346

原创 UVA 1585 Score

Problemhttps://uva.onlinejudge.org/external/15/1585.pdfThinking這題遇到連續O則會開始加總一個會慢慢遞增的數字, 此數字再遇到X時變回1, 此題很簡單, 會記錄此題的原因是我不小心把題目想得太複雜了#include<iostream>using namespace std;void solve(string str){ int

2016-09-02 03:59:20 266

原创 UVA 10474 Where is the Marble?

Problemhttps://uva.onlinejudge.org/external/104/10474.pdfSolution#include<iostream>#define MAX_NUM 10005 // 最大數字為10000using namespace std;int main(){ int N,Q,case_num = 0; //若N和Q為0結束

2016-09-01 22:51:24 483

原创 UVA 10062 Tell me the frequencies!

Problemhttps://uva.onlinejudge.org/external/100/10062.pdfSolution//UVa 10062 Tell me the frequencies!#include<iostream>#include<string>using namespace std;void solve(string str){ int count[130]

2016-09-01 06:07:09 1573

原创 UVA 10018 Reverse and Add

Problemhttps://uva.onlinejudge.org/external/100/10018.pdfSolution#include<iostream>using namespace std;int reverse(unsigned int num){ unsigned int rev = 0; while(num > 0) { rev =

2016-08-31 21:29:49 535

原创 UVA 1368 DNA Consensus String

Problemhttp://write.blog.csdn.net/postlistuva 1368 DNA Consensus String#include<iostream>typedef enum{A=0,C=1,G=2,T=3}e;char DNAChar[4] = {'A','C','G','T'};using namespace std;int main(){ int

2016-08-31 17:30:04 308

原创 UVA 1225 Digit Counting

Problem第一個輸入為testcase次數 第二個數字為n代表從1寫到n寫在一起總共有幾個0-9總共出現多少次, example: 1. n = 3, 123這串數字裡0-9總共出現多少次 2. n = 13, 12345678910111213這串數字裡0-9總共出現多少次Solution// UVa:1225-Digit Counting#include<iostream>u

2016-08-28 22:43:07 741

原创 ITSA [C_ST42-易] 子字串出現次數

Problemhttp://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?a=1376Thinking使用 KMP algo 去算匹配成功的次數Solution#include<iostream> using namespace std; // KMP algo void next(string p, int *f){

2016-08-28 13:12:25 952

原创 ITSA [C_SO06-中] 考試成績排名

Problemhttp://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=2271Thinking對於排序, C++有內建兩種分別是 1. std::sort 2. stable::sort 至於這兩者有什麼差別請你google. 在這邊我們使用std::sort這題題目裡要使用兩個key做排序,所以我就自己設

2016-08-26 15:09:04 873

原创 ITSA [C_SO41-中] 撲克牌排序

Problemhttp://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=20772ThinkingTODOSolution#include<iostream>#include<vector>#include<algorithm>using namespace std;int POKER_PRIORITY[14] = {-1,1

2016-08-26 07:45:37 835

原创 Counting Sort 其實很簡單

準備工作首先,先把自己當成小學生,盡量把自己變得笨一點不要想太多, counting sort沒有任何奇淫技巧, 小學畢業就行開始今天我去上小學, 老師給了你一堆數字, 叫你把這些數字個別計數有多少個, 因為我記憶力不好, 所以最簡單的方式就是我就畫正字記號囉, 如圖:現在要你做一件事情, 看著表格然後你做以下事情: 1. 1有2個, 把1寫出來寫2次 2. 2有0個不用寫 3. 3有3

2016-08-25 21:34:52 792

原创 ITSA [C_ST53-易] 矩陣數字顯示

Problemhttp://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=8018Solution這題的技巧我一開始想不到,我是參考這裡的,看到才恍然大悟原來這麼簡單,有時候怕忘記這種技巧就把它放在文章裡了#include<iostream>#include<string>using namespace std;int main()

2016-08-25 19:02:54 2391

原创 ITSA [C_MM058-中] 二項式求解

Problemhttp://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?a=1005ThinkingTODOSolution#include <iostream>#include <cstring>using namespace std;int main(){ int a,b,c; char str[256]="";

2016-08-25 14:48:01 533

原创 ITSA [C_MM115-中] 奇妙數列

Problemhttp://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=2969ThinkingTODOSolution#include <iostream>#include <set>using namespace std;int main(){ int num; while(cin >> num){

2016-08-25 12:12:33 717

原创 zerojudge b367: 翻轉世界

Problemhttp://zerojudge.tw/ShowProblem?problemid=b367Thinkingversion1矩陣翻轉180度其實就是上下翻轉之後,左右翻轉,最直覺的做法就是在做一個矩陣轉180度,然後跟原本的比對,但是這邊我不這樣做:我們原本讀取陣列的方式是由左至右由上至下,對矩陣做上下翻轉之後,左右翻轉,我們對原本的矩陣由右至左由上至下的去比對,如圖.********

2016-08-24 10:49:06 729

原创 online-judge 參考解答

當不出來的時候,去參考別人的code,去模仿也是好的學習方式,現在只有少少幾個,因為我還是初學,之後用到別的會在補上zerojudge網站 以下參考解答的網址多半是別人的blog 1. ghaouse’s site 2. <<高中生解題系統-參考答案>> zerojudge code 3. https://sites.google.com/site/zsgititit/home/jin-ji

2016-08-24 03:14:15 1147

原创 zerojudge b374: [福州19中]众数

Problemhttp://zerojudge.tw/ShowProblem?problemid=b374Thinking開一個表格計數所有數字出現的個數,然後從表格找出最常出現的數,因為可能會有出現次數一樣的問題,在最後要再檢查其他數字的數量是否跟眾樹一樣,一樣則輸出Code#include <iostream>using namespace std;int main(){ int le

2016-08-24 03:05:34 889

翻译 Program for Fibonacci numbers

本篇文章翻譯自 http://www.geeksforgeeks.org/program-for-nth-fibonacci-number/準備工作首先先看一下Fibonacci numbers的定義 Fn=⎧⎩⎨⎪⎪01Fn−1+Fn−2if n=0if n=1otherwise. F_n = \begin{cases} 0 & \quad \text{if } n

2016-08-12 22:13:33 253

原创 UVA 272 TEX Quotes

#include #include #include using namespace std;int main(int argc, char *argv[]){ string str; bool flag = true; while(getline(cin , str)) { for(int i = 0 ; str[i] != '\0'

2016-07-16 11:54:53 368

翻译 A C Programming Language Puzzle

A C Programming Language Puzzle

2016-06-24 18:50:19 392

翻译 How to find size of array in C/C++ without using sizeof ?

How to find size of array in C/C++ without using sizeof ?

2016-06-24 13:38:06 493

翻译 Lower case to upper case – An interesting fact

Lower case to upper case – An interesting fact

2016-06-24 13:36:51 318

原创 java Iterable and for each

Java apipublic interface Iterable<T> Implementing this interface allows an object to be the target of the “for-each loop”Examplepublic class IterableString implements Iterable<Character> { private

2016-04-06 15:11:46 412

转载 Singleton Pattern (Java)

design patterns

2016-02-18 19:49:20 422

原创 Final Keyword In Java

IntroductionVariablefinal variableblank final instance variableblank final class variableQ Whats the use of blank final variableMethodfinal MethodReference快捷键Markdown及扩展表格定义列表代码块脚注目

2016-01-23 02:20:48 514

原创 ls和du顯示資料夾的size

本人學linux沒多久發現一件事情,使用ls和du顯示資料夾的size竟然不一樣,找了一些資料才懂,所以才決定發這篇文,剛學linux的人可以看一下,已經懂得高手就麻煩你們看一下,有錯請糾正。基礎知識ls - list the directory contentls [OPTION] [FILE]list information about FILEs - -a list all entry -

2015-11-21 23:33:24 410

原创 使用maven + eclipse 建置spark基礎環境

本篇有在windows,osx環境下測試過what is maven?Maven is a build automation tool used primarily for Java projects. - wiki maven是一套主要用於java專案的自動化構建工具.我建議可以先看這篇使用maven,對maven先有基礎的認識,再去看官方文件.進入主題下載maven假設你有eclipse先

2015-11-16 14:30:02 1126

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除