Submission #1833797
Source Code Expand
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<list>
#include<functional>
#define mp make_pair
#define X first
#define Y second
#define INF 1987654321
#define PI 3.14159265358979323846264
#define MOD 100000LL
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef complex<double> base;
ll POW(ll a, ll b) { if (b == 0)return 1; if (b == 1)return a; if (b & 1)return (a*POW(a, b - 1)) % MOD; ll t = POW(a, b / 2); return (t*t) % MOD; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[] = { 0,-1,1,0 }, dy[] = { 1,0,0,-1 };//동북남서
char s[100001];
int main() {
scanf("%s", s);
int g = 0, p = 0;
for (int i=0;s[i];i++)
{
if (s[i] == 'g')g++;
else p++;
}
printf("%d", (g - p) / 2);
}
Submission Info
Submission Time
2017-12-05 10:44:14+0900
Task
D - AtCoDeer and Rock-Paper
User
cheetose
Language
C++14 (GCC 5.4.1)
Score
300
Code Size
1456 Byte
Status
AC
Exec Time
2 ms
Memory
384 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:47:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s", s);
^
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
1 ms
384 KB
1_003.txt
AC
2 ms
256 KB
1_004.txt
AC
2 ms
384 KB
1_005.txt
AC
1 ms
256 KB
1_006.txt
AC
2 ms
384 KB
1_007.txt
AC
1 ms
256 KB
1_008.txt
AC
2 ms
384 KB
1_009.txt
AC
2 ms
384 KB
1_010.txt
AC
2 ms
384 KB
1_011.txt
AC
1 ms
256 KB
1_012.txt
AC
2 ms
384 KB
1_013.txt
AC
1 ms
256 KB
1_014.txt
AC
2 ms
384 KB
1_015.txt
AC
2 ms
256 KB
1_016.txt
AC
2 ms
384 KB
1_017.txt
AC
2 ms
384 KB
1_018.txt
AC
2 ms
384 KB
1_019.txt
AC
1 ms
256 KB
1_020.txt
AC
1 ms
384 KB
1_021.txt
AC
1 ms
384 KB
1_022.txt
AC
1 ms
384 KB
1_023.txt
AC
1 ms
384 KB
1_024.txt
AC
1 ms
384 KB