Submission #1804843
Source Code Expand
#include <cstdio> #include <cstring> const int N = 2e5 + 5; char s[N]; int len, pre, cnt; int main() { scanf("%s", s + 1), len = strlen(s + 1); for (int i = 1; s[i]; ++i) if (s[i] == 'S') ++pre; else if (pre) --pre, ++cnt; printf("%d\n", len - cnt * 2); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | wy1627 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 290 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 384 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:7:41: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s", s + 1), len = strlen(s + 1); ^
Judge Result
Set Name | Sample | Subtask1 | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | 100 / 100 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | example0, example1, example2 |
Subtask1 | example0, example1, example2, sub_corner0, sub_corner1, sub_corner2, sub_rand0, handmade0, handmade1 |
All | corner0, corner1, corner2, example0, example1, example2, handmade0, handmade1, maxrand0, sub_corner0, sub_corner1, sub_corner2, sub_rand0 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
corner0 | AC | 1 ms | 384 KB |
corner1 | AC | 1 ms | 384 KB |
corner2 | AC | 1 ms | 384 KB |
example0 | AC | 0 ms | 128 KB |
example1 | AC | 1 ms | 128 KB |
example2 | AC | 0 ms | 128 KB |
handmade0 | AC | 1 ms | 128 KB |
handmade1 | AC | 1 ms | 128 KB |
maxrand0 | AC | 2 ms | 384 KB |
sub_corner0 | AC | 1 ms | 128 KB |
sub_corner1 | AC | 0 ms | 128 KB |
sub_corner2 | AC | 1 ms | 128 KB |
sub_rand0 | AC | 1 ms | 128 KB |