aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTa180m2020-05-13 17:39:01 -0500
committerTa180m2020-05-13 17:39:01 -0500
commit75cdebec70b5c7abc0eb91f7100bf674658d470b (patch)
tree7ae51348fd1dd6fc53397ce0526c0c78df139b39
parent6835d0aab6dca7332da04236731b777fb12f5888 (diff)
Updated code
-rw-r--r--pascal.cpp12
-rw-r--r--pattern.cpp2
-rw-r--r--square_set.cpp (renamed from square.cpp)0
3 files changed, 7 insertions, 7 deletions
diff --git a/pascal.cpp b/pascal.cpp
index f61f4b1..7d2495d 100644
--- a/pascal.cpp
+++ b/pascal.cpp
@@ -11,14 +11,14 @@ int main() {
int N;
cin >> N;
- if (N <= 500) {
- // if N <= 500 then just use naïve method
+ if (N <= 31) {
+ // if N <= 31 then just use naïve method
for (int i = 0; i < N; ++i) cout << i + 1 << " " << 1 << '\n';
}
else {
- // first we try to make N - 32
- int sum = 0, side = 0, goal = N - 32;
- for (int i = 0; i < 32; ++i) {
+ // first we try to make N - 31
+ int sum = 0, side = 0, goal = N - 31;
+ for (int i = 0; i < 31; ++i) {
cout << i + 1 << " " << (side ? i + 1 : 1) << '\n';
// each row sums to 2 ^ (i + 1)
@@ -32,7 +32,7 @@ int main() {
else ++sum;
}
- for (int i = 32; sum < N; ++i, ++sum) cout << i + 1 << ' ' << (side ? i + 1 : 1) << '\n';
+ for (int i = 31; sum < N; ++i, ++sum) cout << i + 1 << ' ' << (side ? i + 1 : 1) << '\n';
}
}
} \ No newline at end of file
diff --git a/pattern.cpp b/pattern.cpp
index dea6915..c8f4403 100644
--- a/pattern.cpp
+++ b/pattern.cpp
@@ -44,7 +44,7 @@ int main() {
reverse(r.begin(), r.end());
- // Creates at most 2 * 99 + 50 * 98 = 5098 < 1e4 characters
+ // Creates at most ≈5000 < 10000 characters
cout << (ans ? l + m + r : "*") << '\n';
}
} \ No newline at end of file
diff --git a/square.cpp b/square_set.cpp
index 91552c2..91552c2 100644
--- a/square.cpp
+++ b/square_set.cpp