Precreation contest files

This commit is contained in:
2026-02-11 11:28:23 +07:00
parent 0a8ea477bb
commit cb9f7cab30
134 changed files with 1848 additions and 0 deletions

22
misc/others/.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug C++ (input.inp)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/${fileBasenameNoExtension}",
"args": ["<", "${fileBasenameNoExtension}.inp"],
"cwd": "${workspaceFolder}",
"preLaunchTask": "Build C++",
"MIMode": "gdb",
"externalConsole": false,
"setupCommands": [
{
"description": "Enable pretty printing",
"text": "-enable-pretty-printing"
}
]
}
]
}

22
misc/others/.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build C++",
"type": "shell",
"command": "g++",
"args": [
"-std=gnu++17",
"-O0",
"-g",
"${file}",
"-o",
"${fileBasenameNoExtension}"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

BIN
misc/others/a.out Executable file

Binary file not shown.

BIN
misc/others/a.out.conflict1 Normal file

Binary file not shown.

BIN
misc/others/b.out Executable file

Binary file not shown.

BIN
misc/others/beauty Executable file

Binary file not shown.

66
misc/others/beauty.cpp Normal file
View File

@@ -0,0 +1,66 @@
#include <bits/stdc++.h>
using namespace std;
const int maxc = 50000;
char check[maxc + 1];
vector<int> prime;
void sieve() {
for (int i = 0; i < maxc; i++)
check[i] = 1;
check[0] = 0;
check[1] = 0;
for (int i = 2; i * i < maxc; i++)
if (check[i])
for (int j = i * i; j < maxc; j += i)
check[j] = 0;
for (int i = 2; i < maxc; i++) {
if (check[i])
prime.push_back(i);
}
}
int is_db(int n) {
int m = n;
vector<int> factor;
for (int i = 0; i < prime.size() && prime[i]*prime[i]<=n;i++) {
while (n % prime[i] == 0) {
factor.push_back(prime[i]);
n /= prime[i];
}
}
factor.push_back(n);
int facsum = 0;
for (auto i : factor) {
while (i) {
facsum += i % 10;
i /= 10;
}
}
int sum = 0;
while (m) {
sum += m % 10;
m /= 10;
}
if (sum == facsum) {
return 1;
}
return 0;
}
int main() {
int n;
cin >> n;
n++;
sieve();
while (!is_db(n)) {
n++;
}
cout << n << "\n";
}

1
misc/others/beauty.inp Normal file
View File

@@ -0,0 +1 @@
21

BIN
misc/others/lares Executable file

Binary file not shown.

30
misc/others/lares.cpp Normal file
View File

@@ -0,0 +1,30 @@
#include <bits/stdc++.h>
using namespace std;
int m, n, k;
int check(int _x) {
int mn = _x * 2;
int nn = _x;
if (mn < 0 || nn < 0 || m - mn + n - nn < k) {
return 0;
}
return 1;
}
int main() {
cin >> m >> n >> k;
int l = 0, r = min(m / 2, n);
int res = 0;
while (l < r) {
int mid = (l + r) / 2;
if (check(mid)) {
res = max(res, mid);
l = mid + 1;
} else {
r = mid;
}
}
cout << res << '\n';
}

1
misc/others/lares.inp Normal file
View File

@@ -0,0 +1 @@
12 7 5

63
misc/others/other.cpp Normal file
View File

@@ -0,0 +1,63 @@
#include <cmath>
#include <iostream>
using namespace std;
bool isComposite(int n) {
if (n <= 1) {
return false;
}
if (n <= 3) {
return false;
}
if (n % 2 == 0 || n % 3 == 0) {
return true;
}
int i = 5;
while (i * i <= n) {
if (n % i == 0 || n % (i + 2) == 0) {
return true;
}
i = i + 6;
}
return false;
}
int getSum(int n) {
int s = 0;
while (n > 0) {
s += n % 10;
n /= 10;
}
return s;
}
int getPrimeSum(int n) {
int s = 0;
while (n % 2 == 0) {
s += 2;
n /= 2;
}
for (int i = 3; i <= sqrt(n); i += 2) {
while (n % i == 0) {
s += getSum(i);
n /= i;
}
}
if (n > 2) {
s += getSum(n);
}
return s;
}
int main() {
int n;
cin >> n;
while (true) {
if (getSum(n) == getPrimeSum(n)) {
if (getPrimeSum(n) != 0) {
if (isComposite(n)) {
break;
}
}
}
n += 1;
}
cout << n << endl;
return 0;
}