# 淘課計畫
### ~~資工系肯定是hackmd的吧~~
---
## 一些好東西
----
## 輸入/輸出
## cin/cout
----
#### code
```cpp=
int n;
cin>>n;
cout<<n;
```
#### 輸入
```cpp=
5
```
#### 輸出
```cpp=
5
```
----
#### code
```cpp=
string str;
cin>>str;
cout<<str;
```
#### 輸入
```cpp=
Hello!
```
#### 輸出
```cpp=
Hello!
```
----
## 換行
## endl
----
#### code
```cpp=
cout<<"Hello world"<<endl;
cout<<"Hello"<<endl<<"world"<<endl;
```
#### 輸出
```cpp=
Hello world
Hello
world
```
----
## 字串
``` cpp=
string str;
```
----
## 存取字串長度
## (字串名稱).size()
----
#### code
``` cpp=
string str="Hello world";
cout<<str.size();
```
#### 輸出
```cpp=
11
```
----
## 存取字串中某個位置的內容
## (字串名稱)[(存取位置)]
----
#### code
``` cpp=
string str="Hello world";
cout<<str<<endl;
for(int i=0;i<str.size();i++)cout<<str[i];
```
#### 輸出
```cpp=
Hello world
Hello world
```
----
## 讀取整行
``` cpp=
getline(cin,字串名稱);
```
----
#### code
```cpp=
string str;
while(cin>>str){
cout<<str<<endl;
}
```
#### 輸入
```cpp=
hello world!!
```
#### 輸出
```cpp=
hello
world!!
```
----
#### code
```cpp=
string str;
while(getline(cin,str)){
cout<<str<<endl;
}
```
#### 輸入
```cpp=
hello world!!
```
#### 輸出
```cpp=
hello world!!
```
----
## 排序
```cpp=
sort(陣列名稱+起始位置,陣列名稱+結束位置);
```
----
#### code
```cpp=
int arr[10]={2,3,4,6,5,8,7,1,9};
sort(arr,arr+10);
for(int i=0;i<10;i++)cout<<arr[i]<<" ";
```
#### 輸出
```cpp=
0 1 2 3 4 5 6 7 8 9
```
---
## problem A
----
## 題意
#### step1 如果 n = 1 結束
#### step2 如果 n 是奇數 n :arrow_right: 3*n+1
#### step3 否則 n :arrow_right: n/2
#### GOTO step1
----
## hint 1
#### <font color=#000000>簡單照題意模擬就好</font>
#### <font color=#000000>記得用變數紀錄過程中的最大值</font>
---
## problem B
----
## 題意
#### Vito希望從他的家到
#### 所有的親戚的家的距離的和為最小
----
## hint 1
#### <font color=#000000>想一下什麼點到所有點的距離最小</font>
----
## hint 2
#### <font color=#000000>可以試試看今天教的語法</font>
---
## problem C
----
## 題意
#### 給兩個整數 (v表示速度 t表示時間)
#### 求2t秒所經過的距離
----
## hint 1
#### <font color=#000000>v-t圖面積=位移</font>
---
## problem D
----
## 題意
#### 相鄰2個數差的絕對值恰好為1到n-1
#### 稱為jolly jumper
----
#### 例如 1 4 2 3
#### 差值剛好是 3 2 1
#### 是一種 jolly jumper
----
## hint 1
#### <font color=#000000>可以用陣列紀錄出現過的差值</font>
---
## problem E
----
## 題意
#### 有需要可以看中文
#### [zerojudge]("https://zerojudge.tw/ShowProblem?problemid=e579")
<!-- #### 一個社會研究組織採用了一組簡單的參數
#### 模擬國家政黨運作的行為。
#### 參數之一是一個正整數h,h稱為罷會(hartal)參數,它表示同一個政黨連續兩次連續罷會的間隔天數。 -->
----
## hint 1
#### <font color=#000000>題目不難 用陣列好好模擬紀錄罷會時間就好</font>
<!-- #### 輸入T表示測資數
#### N表示天數 P表示政黨數量
#### 接下來 P行會有每個政黨的罷會間隔
---- -->
---
## problem F
----
## 題意
#### <font color=#000000>~~直接貼連結好方便~~</font>
#### [[https://zerojudge.tw/ShowProblem?problemid=c044](https://zerojudge.tw/ShowProblem?problemid=c044)
<!-- #### 一個社會研究組織採用了一組簡單的參數
#### 模擬國家政黨運作的行為。
#### 參數之一是一個正整數h,h稱為罷會(hartal)參數,它表示同一個政黨連續兩次連續罷會的間隔天數。 -->
----
## hint 1
#### <font color=#000000>可以利用今天教的語法</font>
----
## hint 2
#### <font color=#000000>用陣列紀錄每個字母出現的次數</font>
{"title":"淘課計畫","contributors":"[{\"id\":\"bffaf279-8d3a-496c-8b77-a0c84044345e\",\"add\":4895,\"del\":1681}]"}