Skip to content
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;
}