mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 14:56:27 +00:00
#1556. 【2022 正睿 CSP 七连测 Day3】Algebra
https://sjzezoj.com/submission/60918
This commit is contained in:
parent
b1eadac5b2
commit
776bfbc487
57
S2OJ/1556/1556.cpp
Normal file
57
S2OJ/1556/1556.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
int t;
|
||||
|
||||
cin >> t;
|
||||
|
||||
while (t--) {
|
||||
int a, b, c, d;
|
||||
std::vector<std::pair<char, int>> ans;
|
||||
|
||||
cin >> a >> b >> c >> d;
|
||||
|
||||
if ((a == 0 && b == -1) || (c == 0 && d == -1)) {
|
||||
ans.emplace_back('B', 1);
|
||||
std::swap(a, b), std::swap(c, d);
|
||||
a = -a, c = -c;
|
||||
} else if ((a == -1 && b == 0) || (c == -1 && d == 0)) {
|
||||
ans.emplace_back('B', -1);
|
||||
std::swap(a, b), std::swap(c, d);
|
||||
b = -b, d = -d;
|
||||
}
|
||||
|
||||
if (a == 0 && b == 1) {
|
||||
if (d) ans.emplace_back('A', d);
|
||||
ans.emplace_back('B', -1);
|
||||
} else if (b == 0 && a == 1) {
|
||||
ans.emplace_back('B', 1);
|
||||
if (c) ans.emplace_back('A', c);
|
||||
ans.emplace_back('B', -1);
|
||||
} else if (c == 0 && d == 1) {
|
||||
ans.emplace_back('A', -b);
|
||||
} else {
|
||||
ans.emplace_back('B', 1);
|
||||
if (a) ans.emplace_back('A', -a);
|
||||
}
|
||||
|
||||
std::reverse(ans.begin(), ans.end());
|
||||
|
||||
cout << ans.size() << endl;
|
||||
|
||||
for (auto o : ans) {
|
||||
cout << o.first << ' ' << -o.second << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/1556/data/Algebra1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra10.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra100.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra100.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra100.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra100.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra11.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra11.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra12.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra12.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra13.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra13.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra14.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra14.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra15.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra15.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra16.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra16.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra17.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra17.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra18.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra18.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra19.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra19.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra20.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra20.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra20.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra21.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra21.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra21.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra22.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra22.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra22.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra23.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra23.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra23.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra24.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra24.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra24.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra25.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra25.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra25.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra26.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra26.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra26.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra27.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra27.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra27.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra28.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra28.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra28.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra29.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra29.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra29.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra3.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra3.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra30.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra30.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra30.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra31.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra31.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra31.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra31.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra32.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra32.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra32.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra32.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra33.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra33.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra33.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra33.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra34.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra34.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra34.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra34.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra35.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra35.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra35.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra35.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra36.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra36.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra36.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra36.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra37.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra37.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra37.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra37.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra38.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra38.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra38.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra38.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra39.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra39.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra39.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra39.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra4.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra4.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra40.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra40.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra40.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra40.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra41.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra41.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra41.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra41.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra42.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra42.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra42.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra42.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra43.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra43.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra43.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra43.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra44.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra44.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra44.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra44.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra45.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra45.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra45.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra45.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra46.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra46.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra46.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra46.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra47.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra47.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra47.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra47.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra48.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra48.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra48.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra48.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra49.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra49.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra49.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra49.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra5.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra5.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra50.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra50.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra50.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra50.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra51.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra51.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra51.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra51.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra52.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra52.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra52.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra52.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1556/data/Algebra53.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1556/data/Algebra53.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user