rip java and python

This commit is contained in:
Anthony Wang 2020-07-11 18:09:51 -05:00
parent 837914112f
commit a9a4d119c4
11 changed files with 96 additions and 0 deletions

5
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,5 @@
{
"files.associations": {
"iosfwd": "cpp"
}
}

34
gymnastics.cpp Normal file
View file

@ -0,0 +1,34 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
ifstream cin("gymnastics.in");
ofstream cout("gymnastics.out");
int K, N;
cin >> K >> N;
int rnk[11][22];
for (int i = 1; i <= K; ++i) {
for (int j = 1; j <= N; ++j) {
int cow;
cin >> cow;
rnk[i][cow] = j;
}
}
int ans = 0;
for (int a = 1; a <= N; ++a) {
for (int b = 1; b <= N; ++b) {
if (a == b) continue;
bool better = true;
for (int i = 1; i <= K; ++i) {
if (rnk[i][a] > rnk[i][b]) better = false;
}
if (better) ++ans;
}
}
cout << ans;
}

0
gymnastics.java Normal file
View file

0
gymnastics.py Normal file
View file

6
lineup.cpp Normal file
View file

@ -0,0 +1,6 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
}

3
lineup.java Normal file
View file

@ -0,0 +1,3 @@
public class lineup {
}

0
lineup.py Normal file
View file

14
lineup.txt Normal file
View file

@ -0,0 +1,14 @@
read in N
constraints[N][2]
for i from 1 to N:
read in constraints[i][1] and constraints[i][2]
for every permutation P of [ Bessie, Buttercup, Belinda, Beatrice, Bella, Blue, Betsy, Sue ]:
for i from 1 to N:
bad = false
if the position of constraints[i][1] is NOT next to position of constraints[i][2]
then set bad to true
if NOT bad
then output P

34
whereami.cpp Normal file
View file

@ -0,0 +1,34 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
ifstream cin("whereami.in");
ofstream cout("whereami.out");
int N;
cin >> N;
string S;
cin >> S;
for (int K = 1; K <= N; ++K) {
bool good = true;
for (int a = 0; a <= N - K; ++a) {
for (int b = 0; b <= N - K; ++b) {
if (a == b) continue;
bool string_equal = true;
for (int i = 0; i <= K - 1; ++i) {
if (S[a + i] != S[b + i]) string_equal = false;
}
if (string_equal) good = false;
}
}
if (good) {
cout << K;
return 0;
}
}
}

0
whereami.java Normal file
View file

0
whereami.py Normal file
View file