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

add 2018 #1

Open
wants to merge 1 commit 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
24 changes: 24 additions & 0 deletions 2018/penyisihan/c1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <bits/stdc++.h>
using namespace std;

int main() {
int t, n, i, j;
unsigned long long total, noLimit, aa, aNa;
cin >> t;
for(i=0; i < t; i++) {
total = 0;
noLimit = 0;
aa = 0;
aNa = 0;
cin >> n;
for(j=0; j<n; j++) {
total += (j+1);
}
noLimit = total * total;
aa = n*n;
aNa = (total - n) * 2;
n > 1 ? cout << noLimit - aa - aNa << endl : cout << 1 << endl;

}
return 0;
}
36 changes: 36 additions & 0 deletions 2018/warmup/be.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <bits/stdc++.h>

using namespace std;

int main() {
vector <float> K1, K2, K3, K4;
int N;
float X, Y;
cin >> N;
cin >> X >> Y;

for (int i = 0; i < N; i++) {
float P, Q, M;
cin >> P >> Q;
P = P-X;
Q = Q-Y;
//cout << P << ' ' << Q << ' ' << (P/Q) << '\n';
if (P == 0)
M = 0;
else
M = P/Q;
if (P >= 0 && Q > 0 && find(K1.begin(), K1.end(), (M)) == K1.end()) {
K1.push_back(M);
} else if (P < 0 && Q >= 0 && find(K2.begin(), K2.end(), (M)) == K2.end()) {
K2.push_back(M);
} else if (P <= 0 && Q < 0 && find(K3.begin(), K3.end(), (M)) == K3.end()) {
K3.push_back(M);
} else if (P > 0 && Q <= 0 && find(K4.begin(), K4.end(), (M)) == K4.end()) {
K4.push_back(M);
}
}

cout << K1.size() + K2.size() + K3.size() + K4.size() << '\n';

return 0;
}