Submission #1338751
Source Code Expand
#include <bits/stdc++.h>
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
// #define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef std::vector<long> LI;
template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
scan1(x); scan(xs...);
}
struct Solver {
Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
long f(long b, long n) {
long res = 0;
while( n != 0 ) {
res += n % b;
n /= b;
}
return res;
}
void solve() {
std::string str; scan(str);
long res = 0;
for(long i = 0; i < (long)str.size(); ++i) {
if( i % 2 == 0 ) {
if( str[i] == 'p' ) res -= 1;
}
else {
if( str[i] == 'g' ) res += 1;
}
}
printf("%ld\n", res);
}
};
int main() {
loop std::unique_ptr<Solver>(new Solver())->solve();
}
Submission Info
Submission Time |
|
Task |
D - AtCoDeer and Rock-Paper |
User |
spica314 |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
1830 Byte |
Status |
AC |
Exec Time |
5 ms |
Memory |
512 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 300 |
Status |
|
|
Set Name |
Test Cases |
Sample |
0_000.txt, 0_001.txt |
All |
0_000.txt, 0_001.txt, 1_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt |
Case Name |
Status |
Exec Time |
Memory |
0_000.txt |
AC |
1 ms |
256 KB |
0_001.txt |
AC |
1 ms |
256 KB |
1_002.txt |
AC |
4 ms |
512 KB |
1_003.txt |
AC |
3 ms |
384 KB |
1_004.txt |
AC |
4 ms |
512 KB |
1_005.txt |
AC |
3 ms |
384 KB |
1_006.txt |
AC |
4 ms |
512 KB |
1_007.txt |
AC |
1 ms |
256 KB |
1_008.txt |
AC |
4 ms |
512 KB |
1_009.txt |
AC |
4 ms |
512 KB |
1_010.txt |
AC |
4 ms |
512 KB |
1_011.txt |
AC |
3 ms |
384 KB |
1_012.txt |
AC |
4 ms |
512 KB |
1_013.txt |
AC |
1 ms |
256 KB |
1_014.txt |
AC |
4 ms |
512 KB |
1_015.txt |
AC |
4 ms |
436 KB |
1_016.txt |
AC |
5 ms |
512 KB |
1_017.txt |
AC |
4 ms |
512 KB |
1_018.txt |
AC |
4 ms |
512 KB |
1_019.txt |
AC |
1 ms |
256 KB |
1_020.txt |
AC |
4 ms |
512 KB |
1_021.txt |
AC |
4 ms |
512 KB |
1_022.txt |
AC |
4 ms |
512 KB |
1_023.txt |
AC |
4 ms |
512 KB |
1_024.txt |
AC |
4 ms |
512 KB |