Submission #1310278
Source Code Expand
#include<iostream> #include<iomanip> #include<map> #include<unordered_map> #include<set> #include<unordered_set> #include<vector> #include<array> #include<string> #include<stack> #include<queue> #include<algorithm> #include<cassert> #include<functional> #include<random> #include<complex> #include<bitset> #include<chrono> //#include<boost/multiprecision/cpp_int.hpp> #define int int64_t #define uint uint64_t #define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++) #define rep(i, a) REP(i, 0, a) #define EACH(i, a) for (auto i: a) #define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++) #define ALL(a) (a.begin()), (a.end()) #define HAS(a, x) (a.find(x) != a.end()) #define Min(x) *min_element(ALL(x)) #define Max(x) *max_element(ALL(x)) #define Unique(L) (L.erase(unique(ALL(L)), L.end())) #define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/) #define intmax (std::numeric_limits<int64_t>::max() / 4) using namespace std; //typedef boost::multiprecision::cpp_int bigint; const double EPS = 1e-9; const double PI = acos(-1.0); signed main() { cin.tie(0); ios::sync_with_stdio(false); string S; cin >> S; int N = S.size(); int ans = 0; rep(i, N) { if (S[i] == 'U') { ans += N - i - 1; ans += 2 * i; } else { ans += 2 * (N - i - 1); ans += i; } } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Evilator |
User | eukaryo |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1461 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 512 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 2 ms | 512 KB |
02.txt | AC | 2 ms | 512 KB |
03.txt | AC | 2 ms | 512 KB |
04.txt | AC | 2 ms | 512 KB |
05.txt | AC | 2 ms | 512 KB |
06.txt | AC | 2 ms | 512 KB |
07.txt | AC | 2 ms | 512 KB |
08.txt | AC | 2 ms | 512 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 1 ms | 256 KB |
s1.txt | AC | 1 ms | 256 KB |
s2.txt | AC | 1 ms | 256 KB |