Code n Hack in C++
Week 20
IDE
Integrated Development Environment = 整合開發環境
例如 CodeBlocks, Dev-C++, Eclipse, Visual Studio 等等
IDE雲端化
Arduino
一種開發板,可以寫C,控制電路、接感測器、接馬達、、、
範例 https://circuits.io/circuits/3660379-keypad-74595-7segment
按 Start Simulation 開始模擬
按 Code Editor 看程式碼
Raspberry Pi
應科班創客課程 https://y118.hackpad.com
Bebras
證書下載 http://bebras.csie.ntnu.edu.tw
APCS
程式檢測 http://apcs.csie.ntnu.edu.tw
Week19
期末報告
週三班 https://goo.gl/photos/2idcv916hPT9GEyE6
週四班 https://goo.gl/photos/CoV8QkEN4dqqViQW9
Week 18
http://zerojudge.tw/ShowProblem?problemid=a009
- #include<iostream>
- using namespace std;
- int main()
- {
- int KEY = '*' - '1';
- string s;
- while(cin>>s)
- {
- for(int i=0; i<s.length(); i++)
- {
- cout<<char(int(s[i])+KEY);
- }
- cout<<endl;
- }
- return 0;
- }
http://zerojudge.tw/ShowProblem?problemid=a022
- #include<iostream>
- using namespace std;
- int main()
- {
- string s1, s2;
- while(cin>>s1)
- {
- s2="";
- for(int i=s1.length(); i>0; i--)
- s2+=s1[i-1];
- if(s1==s2)
- cout<<"yes"<<endl;
- else
- cout<<"no"<<endl;
- }
- return 0;
- }
http://zerojudge.tw/ShowProblem?problemid=a059
- #include<iostream>
- #include<cmath>
- using namespace std;
- int main()
- {
- int T,a,b,answer;
- cin>>T;
- for(int t=1; t<=T; t++)
- {
- answer=0;
- cin>>a>>b;
- for(int i=a; i<=b; i++)
- {
- if(sqrt(i)==int(sqrt(i)))
- answer+=i;
- }
- cout<<"Case "<<t<<": "<<answer<<endl;
- }
- return 0;
- }
Week 17
http://zerojudge.tw/ShowProblem?problemid=a020
https://zh.wikipedia.org/wiki/ASCII
- #include<iostream>
- using namespace std;
- int main()
- {
- string s;
- int sum;
- int code[26] = {10, 11, 12, 13, 14,
- 15, 16, 17, 34, 18,
- 19, 20, 21, 22, 35,
- 23, 24, 25, 26, 27,
- 28, 29, 32, 30, 31,
- 33
- };
- while(cin>>s)
- {
- sum = (code[s[0]-'A']%10)*9 + code[s[0]-'A']/10;
- for(int i=1; i<9; i++)
- sum += (s[i]-'0')*(9-i);
- sum += s[9]-'0';
- if(sum%10==0)
- cout<<"real"<<endl;
- else
- cout<<"fake"<<endl;
- }
- return 0;
- }
Week 16
http://www.tcgs.tc.edu.tw:1218/ShowProblem?problemid=a026
- #include<iostream>
- using namespace std;
- int main()
- {
- int n;
- while(cin>>n)
- {
- while(n--)
- {
- cout<<"I love you."<<endl;
- }
- }
- return 0;
- }
http://www.tcgs.tc.edu.tw:1218/ShowProblem?problemid=a025
- #include<iostream>
- using namespace std;
- int main()
- {
- int n, m;
- while(cin>>n)
- {
- m = 0;
- while(n)
- {
- m *= 10;
- m += n % 10;
- n /= 10;
- }
- cout<<m<<endl;
- }
- return 0;
- }
http://www.tcgs.tc.edu.tw:1218/ShowProblem?problemid=a021
- #include<iostream>
- using namespace std;
- int main()
- {
- int n;
- while(cin>>n)
- {
- while(n%2==0)
- {
- n /= 2;
- }
- cout<<n<<endl;
- }
- return 0;
- }
http://www.tcgs.tc.edu.tw:1218/ShowProblem?problemid=a022
- #include<iostream>
- using namespace std;
- int main()
- {
- int n,m,x;
- while(cin>>n>>m)
- {
- x = 0;
- while(n<m)
- {
- n *= 3;
- x++;
- }
- cout<<x<<endl;
- }
- return 0;
- }
Week 15
週三班
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=eunaosei 陳怡婷
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=qwerasdfzxcv951 許方源
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=FKGG 吳泓毅
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=sagexm888 邊緣人
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=boyi8966 劉博一
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=luohong1017 羅弘
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=danny0819 李懿增
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=yang891212 楊德文
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=vputpoccnn 鄭皓文
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=opcat 張恩瑋
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=hankbarry 林奕寬
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=js1078688756 蔣森
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=jeffreykuo 郭彥暐
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=geconquista 張庭嘉
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=lucifer 柯傑文
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account= 張皓瑋
週四班
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=f131317303 陳永軒
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=azx8177951 黃煜
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=fang1419 方彥皓
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=Crystalcat 翔宇
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=danny11528 崴丞
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=kevin0980408 義凱
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=whsun9609 周儒澧
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=peterhuang 黃哲謙
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=cooper1228 柯智譯
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=irena0116 林坤萱
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=s226204496 陳彥廷
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=Tim1000 彥霆
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=amy12361236 蔡齡萱
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=wayne3636 羅志偉
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=jimmy900829 王子勳
http://www.tcgs.tc.edu.tw:1218/ShowUserStatistic?account=bruce096037 余冠霏
http://www.tcgs.tc.edu.tw:1218/ShowProblem?problemid=a005
- #include<iostream>
- using namespace std;
- int main()
- {
- int h,w;
- while(cin>>h>>w)
- {
- cout<<h*w<<endl;
- }
- return 0;
- }
http://www.tcgs.tc.edu.tw:1218/ShowProblem?problemid=a016
- #include <iostream>
- using namespace std;
- int main()
- {
- int year;
- while(cin >> year)
- {
- if ((year%400==0)||((year%4==0)&&(year%100!=0)))
- cout<<"YES"<<endl;
- else
- cout<<"NO"<<endl;
- return 0;
- }
- }
http://www.tcgs.tc.edu.tw:1218/ShowProblem?problemid=a027
- #include<iostream>
- using namespace std;
- int main()
- {
- int n;
- while(cin>>n)
- {
- while(n)
- {
- cout<<n--<<" ";
- }
- cout<<0<<endl;
- }
- return 0;
- }
Week 14
週三班
http://zerojudge.tw/Submissions?account=qwerasdfzxcv951 許方源
http://zerojudge.tw/Submissions?account=vputpoccnn 鄭皓文
http://zerojudge.tw/Submissions?account=eunaosei 陳怡婷
http://zerojudge.tw/Submissions?account=sagexm888 張x竣
http://zerojudge.tw/Submissions?account=10626 張恩瑋
http://zerojudge.tw/Submissions?account=10502063 林奕寬
http://zerojudge.tw/Submissions?account=danny0819 李懿增
http://zerojudge.tw/Submissions?account=luohong1017 羅弘
http://zerojudge.tw/Submissions?account=123456789abc 皓瑋
http://zerojudge.tw/Submissions?account=FKGG 吳泓毅
http://zerojudge.tw/Submissions?account=YANG891212 楊德文
http://zerojudge.tw/Submissions?account=luciferTW 柯傑文
http://zerojudge.tw/Submissions?account=lby66 劉博一
http://zerojudge.tw/Submissions?account=geconquista 庭嘉
http://zerojudge.tw/Submissions?account=1078688756 蔣森
http://zerojudge.tw/Submissions?account=jeffreykuo 郭彥暐
週四班
http://zerojudge.tw/Submissions?account=fang1419 方彥皓
http://zerojudge.tw/Submissions?account=Crystalcat 翔宇
http://zerojudge.tw/Submissions?account=danny11528 崴丞
http://zerojudge.tw/Submissions?account=f131317303 永軒
http://zerojudge.tw/Submissions?account=kevin0980408 義凱
http://zerojudge.tw/Submissions?account=whsun9609 周儒澧
http://zerojudge.tw/Submissions?account=peterhuang 黃哲謙
http://zerojudge.tw/Submissions?account=8177951azx 黃煜
http://zerojudge.tw/Submissions?account=cooper1228 柯智譯
http://zerojudge.tw/Submissions?account=irena0116 林坤萱
http://zerojudge.tw/Submissions?account=s226204496 陳彥廷
http://zerojudge.tw/Submissions?account=100001 彥霆
http://zerojudge.tw/Submissions?account=amy12361236 蔡齡萱
http://zerojudge.tw/Submissions?account=wayne3636 羅志偉
http://zerojudge.tw/Submissions?account=jimmy900829 王子勳
http://zerojudge.tw/Submissions?account=bruce096037 余冠霏
http://zerojudge.tw/ShowProblem?problemid=a003
- #include<iostream>
- using namespace std;
- int main()
- {
- int M,D,S;
- while(cin>>M>>D)
- {
- S=(M*2+D)%3;
- if(S==0)
- cout<<"普通"<<endl;
- else
- {
- if(S==1)
- cout<<"吉"<<endl;
- else
- cout<<"大吉"<<endl;
- }
- }
- return 0;
- }
http://zerojudge.tw/ShowProblem?problemid=a006
- #include<iostream>
- #include<cmath> // 呼叫sqrt()需要
- using namespace std;
- void f12(int a, int b, int c); // 宣告f12
- int main()
- {
- int a,b,c;
- while(cin>>a>>b>>c)
- {
- f12(a,b,c); // 呼叫f12()
- }
- return 0;
- }
- void f12(int a, int b, int c) // 定義f12
- {
- int D=b*b-4*a*c;
- if(D<0)
- cout<<"No real root"<<endl;
- else
- {
- if(D==0)
- cout<<"Two same roots x="<<int((-1)*b/(2*a))<<endl;
- else
- cout<<"Two different roots x1="<<int(((-1)*b+sqrt(D))/(2*a))<<" , x2="<<int(((-1)*b-sqrt(D))/(2*a))<<endl;
- }
- }
Week 13
Recursive Functions(遞迴函數)
一元二次方程式可重新輸入
- #include<iostream>
- #include<cmath> // 呼叫sqrt()需要
- using namespace std;
- void f12(int a, int b, int c); // 宣告f12
- int main()
- {
- int a,b,c;
- cout<<"請給我abc(用空白或換行隔開)"<<endl;
- cin>>a>>b>>c;
- f12(a,b,c); // 呼叫f12()
- return 0;
- }
- void f12(int a, int b, int c) // 定義f12
- {
- int D=b*b-4*a*c;
- if(D<0)
- {
- cout<<"無解,請重新輸入"<<endl;
- cin>>a>>b>>c;
- f12(a,b,c);
- }
- else
- {
- if(D==0)
- cout<<"有一解為"<<(-1)*b/(2*a);
- else
- cout<<"有兩解為"<<((-1)*b+sqrt(D))/(2*a)<<"和"<<((-1)*b-sqrt(D))/(2*a);
- }
- }
階乘函數 factorial(n) = n • factorial(n-1)
- #include<iostream>
- using namespace std;
- int factorial(int n) // 宣告同時定義一個階乘函數
- {
- if(n==1)
- return 1;
- return n*factorial(n-1);
- }
- int main()
- {
- int n;
- cout<<"請輸入n:";
- cin>>n;
- cout<<n<<"階乘等於"<<factorial(n);
- return 0;
- }
Week 12
Functions(函數)
宣告及定義一個函數用來解一元二次方程式
- #include<iostream>
- #include<cmath> // 呼叫sqrt()需要
- using namespace std;
- void f12(int a, int b, int c); // 宣告f12
- int main()
- {
- int a,b,c;
- cout<<"請給我abc(用空白或換行隔開)"<<endl;
- cin>>a>>b>>c;
- f12(a,b,c); // 呼叫f12()
- return 0;
- }
- void f12(int a, int b, int c) // 定義f12
- {
- int D=b*b-4*a*c;
- if(D<0)
- cout<<"無解";
- else
- {
- if(D==0)
- cout<<"有一解為"<<(-1)*b/(2*a);
- else
- cout<<"有兩解為"<<((-1)*b+sqrt(D))/(2*a)<<"和"<<((-1)*b-sqrt(D))/(2*a);
- }
- }
隨機函數 rand()
http://www.cplusplus.com/reference/cstdlib/rand/
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- cout << rand() <<endl;
- cout << rand() <<endl;
- cout << rand() <<endl;
- cout << rand() <<endl;
- cout << RAND_MAX;
- }
https://www.hopenglish.com/a-delightful-way-to-teach-kids-about-computers
開頭:Code is the next universal language.
結尾:Programming gives me this amazing power to build my whole little universe with its own rules and paradigms and practices. Create something out of nothing with the pure power of logic.
Week 11
Bebras 國際運算思維挑戰賽
http://bebras.csie.ntnu.edu.tw
Week 10
Pointers(指標變數)
- #include<iostream>
- using namespace std;
- int main()
- {
- int a=55;
- int b=66;
- int* c=&a;//指標變數就是存位址的
- int* d=c;
- cout << "整數變數 a 的值是 " << a << endl;
- cout << "整數變數 a 的址是 " << &a << endl;
- cout << "整數變數 b 的值是 " << b << endl;
- cout << "整數變數 b 的址是 " << &b << endl;
- cout << "指標變數 c 的值是 " << c << endl;
- cout << "指標變數 d 的值是 " << d << endl;
- cout << "指標變數 d 指到的值是 " << *d << endl;
- *d=77;
- cout << "整數變數 a 的值是 " << a << endl;
- return 0;
- }
Week11or12 http://bebras.csie.ntnu.edu.tw (先試試 https://goo.gl/8aQ9M1)
做完 Functions,玩 judge
greenjudge: http://www.tcgs.tc.edu.tw:1218
zerojudge: http://zerojudge.tw
Week 9
用陣列和迴圈寫泡沫排序
輸入N個數
由小到大排列
- #include<iostream>
- using namespace std;
- int main()
- {
- //鍵盤輸入N個數
- int n;
- cin>>n;
- int arr[n];
- for(int i=0; i<n; i++)
- cin>>arr[i];
- //大的往右移動
- for(int i=0; i<n-1; i++)
- for(int j=0; j<n-1-i; j++)
- if(arr[j]>arr[j+1])
- swap(arr[j], arr[j+1]);
- //螢幕輸出排序過的N個數
- for(int i=0; i<n; i++)
- cout<<arr[i]<<" ";
- return 0;
- }
由大到小排列只要改一個運算子
Week 8
Arrays(陣列)
- int age[10]; //宣告整數陣列,從age[0]到age[9]
Bubble Sort
*
Bubble Sort vs Quick Sort
*
Week 6
- switch(變數)
- {
- case: 值
- 程式碼;
- break;
- case: 值
- 程式碼;
- break;
- case: 值
- 程式碼;
- break;
- default:
- 程式碼;
- }
可以自己先看JavaScript的tutorial
https://www.sololearn.com/Course/JavaScript/
JavaScript語言是用來寫網頁程式的
https://www.chromeexperiments.com
Week 5
用巢狀迴圈印出九九乘法
- #include <iostream>
- using namespace std;
- int main()
- {
- for(int i=0;i<9;i++)
- {
- for(int j=0;j<9;j++)
- {
- cout << i+1 << "x" << j+1 <<"=" << (i+1)*(j+1) <<"\ ";
- }
- cout << endl;
- }
- return 0;
- }]
Week 4
Loops(迴圈重複)
- while (真或假)
- { 程式碼;
- 程式碼;
- 程式碼; }
- for (變數初始; 真或假; 變數改變)
- { 程式碼;
- 程式碼;
- 程式碼; }
Week 3
Conditionals(條件判斷)
- if(真或假)
- {
- 程式碼;
- 程式碼;
- 程式碼;
- }
- else
- {
- 程式碼;
- 程式碼;
- 程式碼;
- }
Week 2
SoloLearn.com(自學.com)
再次提醒:
1. No games unless you write a game
2. 不小心刪到別人寫的東西可以按ctrl+z回復
- //Type in a code to declare variable b and assign a's value to b, and then print their sum to the screen.
- int a = 15;
- int b = a ;
- cout << a + b << endl;
- x = x + 5;
- x += 5;
- x = x / 3;
- x /= 3;
- x = x % 3;
- x %= 3;
- x++;
- ++x;
Week 1
#1 辦Google帳號
#3 寫Hackpad - a post, a language, a thing
#4 禁game, unless you made it
#5 加LINE
週三班
http://line.me/R/ti/g/qKz7aTZgFk

1. post : 圖靈究竟是如何破解德軍的密碼系統 ?
2. language : C語言
3. thing : 槍戰遊戲 by:張恩瑋 10/10
我最喜歡的post
究竟圖靈是怎樣破解德軍的密碼系統 Enigma?language:C語言
A thing:一個網頁或一個遊戲 By:張庭嘉
1 The Post: 圖靈究竟是如何破解德軍的密碼系統 ?
2 The Language: C++
3 The Thing: a game, i exepct
1.POST :https://buzzorange.com/techorange/2015/01/15/which-language-should-you-start-with/
2.. language : C語言
3. thing : 3D/電玩/網頁 By:羅弘
1.post:http://www.inside.com.tw/2016/05/20/misunderstanding-internet-of-things
2.language : C語言
3.thing :戰略遊戲
1:post 究竟圖靈是怎麼破解德軍的密碼系統Enigma?
2:language C語言
3:a thing APP、遊戲 By 郭彥暐
http://edm.bnext.com.tw/2016-code/
想學:python
可以自己試試看,感覺很有趣(但我失敗了)
希望之後可以學到如何寫基本的應用程式,對遊戲比較沒興趣(玩比較爽)
希望可以學到拿來做壞事的程度
樓上要被關照了
http://edm.bnext.com.tw/2016-code/
C語言
沒想到
first.
用Python设计第一个游戏 https://www.youtube.com/watch?v=FGaNNYMl6jE
second.
language:python C語
third.
thing;能可以利用python設置給人們利用遊戲
建造一個世界觀,but遊戲越簡單越好,也是能比較花更多時間去玩的
((有可能做不出來就是了~~~
1.POST 數位時代I 他們用程式寫未來 http://edm.bnext.com.tw/2016-code/ 說明程式語言的重要性
2.LANGUAGE C語言
3.THING 我想突破被上鎖的網站OR程式
post:美國教授用機器人回覆學生傳來的問題,沒有學生發現跟自己對話的不是人類
機器人的效率很快 幫忙省了很多時間
language:C++
thing:App 遊戲 病毒
(想當小老師)
post:究竟圖靈是怎樣破解德軍的密碼系統 Enigma? (同性戀最屌?
language : C語言
thing:你覺得我會寫什麼 (幫QQ 想到在跟你說 先決定做APP(哈!
1.post:我覺得【究竟圖靈是怎樣破解德軍的密碼系統 Enigma?】這篇貼文很有趣,因為我覺得能夠破解2戰德軍的密碼是很厲害的,雖然它被發現有BUG,但如果加以改良後,必定能運用更多的事情上
2:lanugage:C語言(其實還沒決定)
3:thing:做出一個game BY:李懿增
週四班
http://line.me/R/ti/g/VxgJcA-xrF

1.post:https://buzzorange.com/techorange/2015/01/15/which-language-should-you-start-with/
language:python
thing:做出能使用的程式 或者做出能夠用中文編寫的工具即使他實際上是英文的
by陳永軒
post:究竟圖靈是怎樣破解德軍的密碼系統 Enigma?
language:python
thing:APP
by張崴丞
1.post:我覺得這篇文章是一很好的參考數據
http://spectrum.ieee.org/computing/software/the-2016-top-programming-languages
2.language:C python
3.thing: web 跟作業系統方面有關的
by蔡翔宇
1.post:究竟圖靈是怎樣破解德軍的密碼系統 Enigma?
2.language: C C++
3.thing: game
1.post:究竟圖靈是怎樣破解德軍的密碼系統 Enigma ?
2.langugage:C++
3.thing: 做ㄧ個APP(IOS)
By曾義凱
1.post :究竟圖靈是怎樣破解德軍的密碼系統Enigma?
2.language:C Java
3.thing:製作電腦程式、學習老師的跑馬燈
by 柯智譯 =3=
1.post:24歲程式者之路:從創造自己的世界跟社群分享
2.language:C Java
3.thing:創造屬於自己的個 GAME APP
by:黃哲謙
1.Language:C、 Python
2.Thing:想學如何知道一台電腦的語言和破解電腦密碼和網路密碼
3.Post:究竟圖靈是怎樣破解德軍的密碼系統 ?
我自願當
1.post:學程式不到三年 靠「求職天眼通」一戰成名
2.language:C
3.thing:想學點東西
1.post:圖靈究竟是如何破解德軍的密碼系統 ?
2.language:C 語言
3.thing:實境多人RPG/試作程式 By.周儒澧
1.post:究竟圖靈是怎樣破解德軍的密碼系統?
2.language:Python
3.thing:學習更多我沒學過的事
1post:數位時代 他們用程式寫未來 我們用程式解國小數學
2language:Python
3.thing:想學前面的跑馬燈和老師ig一個按按鈕就會唱歌的東東
by 蔡齡萱
1.post:究竟圖靈是怎樣破解德軍的密碼系統?
2.language:Python
3.thing:APP 製作圖片的應用程式
1.post圖靈究竟是如何破解德軍的密碼系統 ?
2.language
3.thing
1.post:圖靈究竟是如何破解德軍的密碼系統?
2.language:C語言
3.thing:想寫一個讓人易懂的程式,想把英文學到淋漓盡致
1.post:圖靈究竟是如何破解德軍的密碼系統?
2.language:C語言
3.thing:英文雖然不太好,但還是希望可以寫一個大家都會用,而且方便的程式
by 黃煜