Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

33419 955100吳O恩 #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions fishing.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <iostream>
using namespace std;

int main() {
int X, Y;
cin >> X >> Y;

int N;
cin >> N;

int minLengthLength = 999999; // > 250000
int minA, minB;

for (int i = 1; i <= N; i++) {
int A, B;
cin >> A >> B;

int CC;
CC = ((A - X) * (A - X)) + ((B - Y) * (B - Y));

if (CC < minLengthLength) {
minLengthLength = CC;
minA = A;
minB = B;
}
}

cout << minA << " " << minB;
}
51 changes: 51 additions & 0 deletions taxi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include <iostream>
using namespace std;

int main() {
int K, W, S, E;
cin >> K >> W >> S >> E;

// 計程運價:起程 2 公里內皆為 20 元,續程每滿 1 公里加 5 元。
int ans1;

if (K <= 2) {
ans1 = 20;
} else {
ans1 = 20 + (K - 2) * 5;
}

// 延滯計時運價:延滯時間每滿 2 分鐘加 5 元。
int ans2;

ans2 = (W / 2) * 5;

// 夜間加成運價
int ans3 = 0;

// 晚間 18 時至 19 時 185 元
if (S <= 18 && E >= 19) {
ans3 += 185;
}

// 晚間 19 時至 20 時 195 元
if (S <= 19 && E >= 20) {
ans3 += 195;
}

// 晚間 20 時至 21 時 205 元
if (S <= 20 && E >= 21) {
ans3 += 205;
}

// 晚間 21 時至 22 時 215 元
if (S <= 21 && E >= 22) {
ans3 += 215;
}

// 晚間 22 時至 23 時 225 元
if (S <= 22 && E >= 23) {
ans3 += 225;
}

cout << ans1 + ans2 + ans3;
}