diff --git a/atcoder/abc052/A/main.cpp b/atcoder/abc052/A/main.cpp new file mode 100644 index 00000000..c9384b61 --- /dev/null +++ b/atcoder/abc052/A/main.cpp @@ -0,0 +1,17 @@ +#include + +using namespace std; +using ll = long long; + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(0); cout.tie(0); + + int A, B, C, D; + cin >> A >> B >> C >> D; + + int S = A * B, R = C * D; + cout << max(S, R) << endl; + + return 0; +} \ No newline at end of file diff --git a/atcoder/abc052/B/main.cpp b/atcoder/abc052/B/main.cpp new file mode 100644 index 00000000..211a2356 --- /dev/null +++ b/atcoder/abc052/B/main.cpp @@ -0,0 +1,24 @@ +#include + +using namespace std; +using ll = long long; + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(0); cout.tie(0); + + int N; + string S; + cin >> N >> S; + + int maxx = 0; + int x = 0; + for (auto ch : S) { + if (ch == 'I') ++x; + if (ch == 'D') --x; + maxx = max(maxx, x); + } + cout << maxx << endl; + + return 0; +} \ No newline at end of file diff --git a/atcoder/abc052/C/main.cpp b/atcoder/abc052/C/main.cpp new file mode 100644 index 00000000..bcccc765 --- /dev/null +++ b/atcoder/abc052/C/main.cpp @@ -0,0 +1,57 @@ +#include + +using namespace std; +using ll = long long; + +ll const MOD = 1e9+7; +int const M = 1e3+1; + +set seive() { + vector is_prime(M, true); + is_prime[0] = is_prime[1] = false; + for (int i = 2; i * i <= M; ++i) { + if (!is_prime[i]) continue; + for (int j = i * 2; j < M; j += i) { + is_prime[j] = false; + } + } + + set primes; + for (int i = 2; i < M; ++i) { + if (is_prime[i]) { + primes.insert(i); + } + } + return primes; +} + +ll solve(int N) { + auto primes = seive(); + vector factors(M, 0); + for (int i = N; i >= 2; --i) { + int v = i; + for (auto p : primes) { + while (v % p == 0) { + v /= p; + ++factors[p]; + } + } + } + + ll ans = 1; + for (int i = 0; i < M; ++i) { + ans = (ans * (factors[i]+1)) % MOD; + } + return ans; +} + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(0); cout.tie(0); + + int N; + cin >> N; + cout << solve(N) << endl; + + return 0; +} \ No newline at end of file diff --git a/atcoder/abc052/D/main.cpp b/atcoder/abc052/D/main.cpp new file mode 100644 index 00000000..de4172ea --- /dev/null +++ b/atcoder/abc052/D/main.cpp @@ -0,0 +1,30 @@ +#include + +using namespace std; +using ll = long long; + +int N, A, B; +vector X; + +ll solve() { + ll ans = 0; + for (int i = 1; i < N; ++i) { + ll w = X[i] - X[i-1]; + ans += min(w * A, ll(B)); + } + return ans; +} + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(0); cout.tie(0); + + cin >> N >> A >> B; + X.assign(N, 0); + for (int i = 0; i < N; ++i) { + cin >> X[i]; + } + cout << solve() << endl; + + return 0; +} \ No newline at end of file