Submission #1575858
Source Code Expand
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define BIG 2000000007
#define MOD 1000000007
typedef unsigned long long ull;
typedef signed long long sll;
typedef struct {
int a;
int b;
} hw;
#define N_MAX 100000
#define M_MAX 100000
ull n, m, k;
ull h, w;
ull va, vb, vc, vd;
// ull a[N_MAX];
// sll a[N_MAX];
// ull b[N_MAX];
// ull dp[N_MAX][M_MAX + 1];
char s[N_MAX + 1];
// char t[N_MAX + 1];
// hw arr[N_MAX];
void swap_adj(ull *a, ull *b){
ull tmp = *b;
*b = *a;
*a = tmp;
return;
}
ull divide(ull a, ull b){
ull x = MOD - 2;
ull ans = 1;
while (x) {
if (x & 1) ans = (ans * b) % MOD;
b = (b * b) % MOD;
x /= 2;
}
return (a * ans) % MOD;
}
int digits(ull x){
int i = 1;
while (x >= 10) {
x /= 10;
i++;
}
return i;
}
int min(ull x, ull y){
return (x < y) ? x : y;
}
ull gcd(ull x, ull y){
if (x < y) {
return gcd(y, x);
} else if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
ull bitpow(ull a, ull x){
ull result = 1;
while (x) {
if (x & 1) {
result *= a;
result %= MOD;
}
x /= 2;
a = (a * a) % MOD;
}
return result;
}
int comp(const void *left, const void *right){
if ((*(int*)left) < (*(int*)right)) {
return -1;
} else if ((*(int*)left) > (*(int*)right)) {
return +1;
} else {
return 0;
}
}
// int nextroute(int arr[]){
// int i = n - 1;
// int j, x;
// while (arr[i - 1] > arr[i]) i--;
// x = n;
// for (j = i; j < n; j++) {
// if (arr[j] < arr[i - 1]) continue;
// if (x == n || arr[x] > arr[j]) x = j;
// }
// arr[i - 1] ^= arr[x];
// arr[x] ^= arr[i - 1];
// arr[i - 1] ^= arr[x];
// qsort(&arr[i], n - i, sizeof(int), comp);
// return 0;
// }
ull solve(){
int i, j;
ull result;
const size_t len = strlen(s);
result = len * (len - 1);
for (i = 0; i < len - 1; i++) {
if (s[i] == 'U') {
result += i;
} else {
result += (len - i - 1);
}
}
printf("%llu\n", result);
return 0;
}
int main(void){
int i, j;
// scanf("%llu", &n);
// scanf("%llu%llu%llu%llu", &va, &vb, &vc, &vd);
scanf("%s", s);
solve();
return 0;
}
Submission Info
Submission Time
2017-09-09 16:53:47+0900
Task
B - Evilator
User
sheyasutaka
Language
C (GCC 5.4.1)
Score
400
Code Size
2248 Byte
Status
AC
Exec Time
1 ms
Memory
256 KB
Compile Error
./Main.c: In function ‘main’:
./Main.c:137:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s", s);
^
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
1 ms
256 KB
02.txt
AC
1 ms
256 KB
03.txt
AC
1 ms
256 KB
04.txt
AC
1 ms
256 KB
05.txt
AC
1 ms
256 KB
06.txt
AC
1 ms
256 KB
07.txt
AC
1 ms
256 KB
08.txt
AC
1 ms
256 KB
09.txt
AC
1 ms
128 KB
10.txt
AC
1 ms
128 KB
s1.txt
AC
1 ms
128 KB
s2.txt
AC
1 ms
128 KB