---
# System prepended metadata

title: Untitled

---

#冠翔訓練1101
## 1102-1
![](https://i.imgur.com/o9vg94W.png)
```cpp=
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,db;
	cout<<"請輸入位置: ";
	while(cin>>n)
	{
		if(n>0)
		{
			cout<<"DAY: ";
			cout<<n*2-1<<"\n";
		}
        else{
        	cout<<"DAY: ";
			db=n*-2;
            cout<<db<<"\n";
		}
	cout<<"請輸入位置: ";
	}
	return 0; 
}
```

## 1102-2
![](https://i.imgur.com/IN57h8P.png)
```cpp=
#include<bits/stdc++.h>
using namespace std;

int main(){
	int hi, mi, hf, mf, H, M;
	cout<<"輸入起始時間";
	cin >> hi >> mi;
	cout<<"輸入結束時間";
	cin >> hf >> mf;
	H = hf-hi;
	M = mf-mi;
	if (M<0)
	{
		H-=1;
		M+=60;
	}
	cout<<"校長站了"<<H<<"小時"<<M<<"分"<<"\n";
	return 0;
}
```