icpc:problems:luogup2952
差别
这里会显示出您选择的修订版和当前版本之间的差别。
后一修订版 | 前一修订版 | ||
icpc:problems:luogup2952 [2024/02/01 11:47] – 创建 温婕莺 | icpc:problems:luogup2952 [2024/03/27 02:36] (当前版本) – format code 温婕莺 | ||
---|---|---|---|
行 8: | 行 8: | ||
<code c++> | <code c++> | ||
- | # | + | #include < |
const int N = 100010; | const int N = 100010; | ||
- | int line1[N], | + | int line1[N], line2[N]; |
- | int head1=1, last1=0, head2=1, last2=0, cnt; | + | int head1 = 1, last1 = 0, head2 = 1, last2 = 0, cnt; |
int main() { | int main() { | ||
- | int s, temp; char mod, turn; | + | |
- | scanf(" | + | |
- | for(int i=1; i<=s; i++) { | + | scanf(" |
- | scanf(" | + | for (int i = 1; i <= s; i++) { |
- | if(mod == ' | + | scanf(" |
- | ++cnt; | + | if (mod == ' |
- | if(turn==' | + | ++cnt; |
- | line1[++last1] = cnt; | + | if (turn == ' |
- | else | + | line1[++last1] = cnt; |
- | line2[++last2] = cnt; | + | else |
- | } | + | line2[++last2] = cnt; |
- | else { | + | } else { |
- | scanf(" | + | scanf(" |
- | if(turn == ' | + | if (turn == ' |
- | if(temp > (last2-head2+1)) { | + | if (temp > (last2 - head2 + 1)) { |
- | temp -= (last2-head2+1); | + | temp -= (last2 - head2 + 1); |
- | last2 = head2-1; | + | last2 = head2 - 1; |
- | if(temp > 0) head1 += temp; | + | head1 += temp; |
- | } | + | } else |
- | else | + | last2 -= temp; |
- | last2 -= temp; | + | } else { |
- | } | + | if (temp > (last1 - head1 + 1)) { |
- | else { | + | temp -= (last1 - head1 + 1); |
- | if(temp > (last1-head1+1)) { | + | last1 = head1 - 1; |
- | temp -= (last1-head1+1); | + | head2 += temp; |
- | last1 = head1-1; | + | } else |
- | if(temp > 0) head2 += temp; | + | last1 -= temp; |
- | } | + | } |
- | else | + | } |
- | last1 -= temp; | + | } |
- | } | + | for (int i = last1; i >= head1; i--) |
- | } | + | printf(" |
- | } | + | for (int i = head2; i <= last2; i++) |
- | for(int i=last1; i> | + | printf(" |
- | printf(" | + | return 0; |
- | for(int i=head2; i< | + | |
- | printf(" | + | |
- | return 0; | + | |
} | } | ||
</ | </ |
/app/www/public/data/pages/icpc/problems/luogup2952.txt · 最后更改: 2024/03/27 02:36 由 温婕莺