Submission #1311252
Source Code Expand
#include <cstdio> #include <iostream> #include <array> #include <vector> #include <algorithm> #include <functional> #include <tuple> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <queue> #include <utility> #include <memory> #include <valarray> #include <climits> using namespace std; using ll = long long int; #define loop(i, N) for (int i = 0; i < N; ++i) #define scanInt(x) int x; scanf("%d", &x); getchar(); #define scanLLInt(x) ll x; scanf("%lld", &x); getchar(); #define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();} #define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();} int main() { char str[100001]; fgets(str, 100001, stdin); int size = 0; while (str[size] == 'U' || str[size] == 'D') ++size; ll sum = 0; loop(i, size){ if (str[i] == 'U'){ sum += (size - 1); sum += i; }else if (str[i] == 'D'){ sum += (size - 1); sum += (size - 1 - i); } } printf("%lld\n", sum); }
Submission Info
Submission Time | |
---|---|
Task | B - Evilator |
User | painfulness |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1141 Byte |
Status | AC |
Exec Time | 12 ms |
Memory | 384 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:31:30: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result] fgets(str, 100001, stdin); ^
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 | 384 KB |
02.txt | AC | 2 ms | 384 KB |
03.txt | AC | 2 ms | 384 KB |
04.txt | AC | 2 ms | 384 KB |
05.txt | AC | 2 ms | 384 KB |
06.txt | AC | 2 ms | 384 KB |
07.txt | AC | 2 ms | 384 KB |
08.txt | AC | 2 ms | 384 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 | 12 ms | 384 KB |