diff --git a/atcoder/abc055/A/main.cpp b/atcoder/abc055/A/main.cpp new file mode 100644 index 00000000..37dbf5a9 --- /dev/null +++ b/atcoder/abc055/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 N; + cin >> N; + int x = N * 800; + int y = N / 15 * 200; + cout << x - y << endl; + + return 0; +} \ No newline at end of file diff --git a/atcoder/abc055/B/main.cpp b/atcoder/abc055/B/main.cpp new file mode 100644 index 00000000..f9b320ed --- /dev/null +++ b/atcoder/abc055/B/main.cpp @@ -0,0 +1,25 @@ +#include + +using namespace std; +using ll = long long; + +ll solve(int N) { + const ll MOD = 1e9+7; + ll p = 1; + for (int i = 0; i < N; ++i) { + p *= (i+1); + p %= MOD; + } + return p; +} + +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/abc055/C/main.cpp b/atcoder/abc055/C/main.cpp new file mode 100644 index 00000000..8ebb5a1e --- /dev/null +++ b/atcoder/abc055/C/main.cpp @@ -0,0 +1,22 @@ +#include + +using namespace std; +using ll = long long; + +ll solve(ll N, ll M) { + if (N >= M / 2) { + return M / 2; + } + return N + (M - 2 * N) / 4; +} + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(0); cout.tie(0); + + ll N, M; + cin >> N >> M; + cout << solve(N, M) << endl; + + return 0; +} \ No newline at end of file diff --git a/atcoder/abc055/D/main.cpp b/atcoder/abc055/D/main.cpp new file mode 100644 index 00000000..d1c76136 --- /dev/null +++ b/atcoder/abc055/D/main.cpp @@ -0,0 +1,56 @@ +#include + +using namespace std; +using ll = long long; + +int N; +string S; + +bool solve(vector& ws, char c0, char c1) { + ws[0] = c0, ws[1] = c1; + for (int i = 1; i < N; ++i) { + int j = (i - 1 + N) % N, k = (i + 1) % N; + if (S[i] == 'o') { + if (ws[i] == 'S') ws[k] = ws[j]; + if (ws[i] == 'W') ws[k] = ws[j] == 'S' ? 'W' : 'S'; + } + if(S[i] == 'x') { + if (ws[i] == 'S') ws[k] = ws[j] == 'S' ? 'W' : 'S'; + if (ws[i] == 'W') ws[k] = ws[j]; + } + } + bool satisfy = true; + for (int i = 0; i < N; ++i) { + int j = (i - 1 + N) % N, k = (i + 1) % N; + if (S[i] == 'o') { + if (ws[i] == 'S') satisfy &= (ws[k] == ws[j]); + if (ws[i] == 'W') satisfy &= (ws[k] != ws[j]); + } + if (S[i] == 'x') { + if (ws[i] == 'S') satisfy &= (ws[k] != ws[j]); + if (ws[i] == 'W') satisfy &= (ws[k] == ws[j]); + } + } + return satisfy; +} + +vector solve() { + vector ws(N, ' '); + if (solve(ws, 'S', 'S')) return ws; + if (solve(ws, 'S', 'W')) return ws; + if (solve(ws, 'W', 'S')) return ws; + if (solve(ws, 'W', 'W')) return ws; + return {}; +} + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(0); cout.tie(0); + + cin >> N; + cin >> S; + auto ans = solve(); + cout << (ans.size() == 0 ? "-1" : string(ans.begin(), ans.end())) << endl; + + return 0; +} \ No newline at end of file