Submission #2673138
Source Code Expand
#include <bits/stdc++.h> using namespace std; const int MAXN = 100005; char str[MAXN]; int main() { scanf("%s", str+1); long long ans = 0; for (int i = 1; i <= n; i++) { if (str[i] == 'U') ans += 2*(i-1)+(n-i); else ans += 2*(n-i)+(i-1); } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Evilator |
User | ljt12138 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 304 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:12:23: error: ‘n’ was not declared in this scope for (int i = 1; i <= n; i++) { ^ ./Main.cpp:10:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s", str+1); ^