mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 18:48:48 +00:00
parent
838adadd01
commit
2fcc1f4f10
48
S2OJ/1493/1493.cpp
Normal file
48
S2OJ/1493/1493.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
const int N = 25;
|
||||||
|
|
||||||
|
int r, p, s, f[1 << N];
|
||||||
|
std::string sr[N], sp[N], ss[N];
|
||||||
|
|
||||||
|
int highbit(int x) {
|
||||||
|
return 32 - __builtin_clz(x) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::ios::sync_with_stdio(false);
|
||||||
|
cin.tie(nullptr);
|
||||||
|
|
||||||
|
cin >> r >> p >> s;
|
||||||
|
|
||||||
|
sr[0] = "R", sp[0] = "P", ss[0] = "S";
|
||||||
|
|
||||||
|
for (int i = 1; i <= 20; i++) {
|
||||||
|
f[1 << i] = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= 20; ++i) {
|
||||||
|
sp[i] = std::min(sr[i - 1] + ss[i - 1], ss[i - 1] + sr[i - 1]);
|
||||||
|
sr[i] = std::min(ss[i - 1] + sp[i - 1], sp[i - 1] + ss[i - 1]);
|
||||||
|
ss[i] = std::min(sp[i - 1] + sr[i - 1], sr[i - 1] + sp[i - 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f[r + p + s] == -1) {
|
||||||
|
cout << "IMPOSSIBLE" << endl;
|
||||||
|
} else if (r != p && r != s && p == s && std::abs(r - s) == 1) {
|
||||||
|
cout << sr[f[r + p + s]] << endl;
|
||||||
|
} else if (p != r && p != s && r == s && std::abs(p - r) == 1) {
|
||||||
|
cout << sp[f[r + p + s]] << endl;
|
||||||
|
} else if (s != p && s != r && p == r && std::abs(s - p) == 1) {
|
||||||
|
cout << ss[f[r + p + s]] << endl;
|
||||||
|
} else {
|
||||||
|
cout << "IMPOSSIBLE" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
S2OJ/1493/data/data1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data10.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data3.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data4.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data5.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data6.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data7.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data8.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/data9.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/data9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1493/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1493/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user