0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 21:28:48 +00:00

Compare commits

..

No commits in common. "7cd104939199d67f54faaa9423d344b49f8cb301" and "8106ea66f58e776b6c93e7e0bc38827b38b2d3dd" have entirely different histories.

4 changed files with 0 additions and 163 deletions

View File

@ -1,42 +0,0 @@
#include <iostream>
#include <cmath>
using std::cin;
using std::cout;
const char endl = '\n';
long long n;
bool flag;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
long long x = n;
for (long long i = 2; i <= std::sqrt(n); i++) {
if (x % i == 0) {
int cnt = 0;
while (x % i == 0) x /= i, cnt++;
if (flag) cout << " * ";
else flag = true;
if (cnt > 1) {
cout << i << '^' << cnt;
} else {
cout << i;
}
}
}
if (x > 1) {
if (flag) cout << " * ";
cout << x;
}
return 0;
}

View File

@ -1,48 +0,0 @@
#include <iostream>
#include <algorithm>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 505;
int n, ans;
bool t[N];
struct node {
int t, r;
} a[N];
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i].t;
}
for (int i = 1; i <= n; i++) {
cin >> a[i].r;
}
std::sort(a + 1, a + 1 + n, [&](const node &a, const node &b) {
return a.r > b.r;
});
for (int i = 1; i <= n; i++) {
for (int j = a[i].t; j; j--) {
if (!t[j]) {
t[j] = true;
ans += a[i].r;
break;
}
}
}
cout << ans << endl;
return 0;
}

View File

@ -1,39 +0,0 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 15;
int n, a[N], ans;
int gcd(int x, int y) {
if (x == 0) return y;
return gcd(y % x, x);
}
int lcm(int x, int y) {
return x / gcd(x, y) * y;
}
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
ans = a[0];
for (int i = 1; i < n; i++) {
ans = lcm(ans, a[i]);
}
cout << ans << endl;
return 0;
}

View File

@ -1,34 +0,0 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 1e6 + 5;
int n, b, a[N]{0, 1}, cnt;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> b;
for (int i = 2; i <= n; i++) {
if (a[i] == 0) {
for (int j = i; j <= n; j += i) {
a[j] = i;
}
}
}
for (int i = 1; i <= n; i++) {
if (a[i] <= b) {
cnt++;
}
}
cout << cnt << endl;
return 0;
}