Skip to content

Instantly share code, notes, and snippets.

@theoremoon
Created January 12, 2015 11:17
Show Gist options
  • Save theoremoon/3cc622cc3266f55e683b to your computer and use it in GitHub Desktop.
Save theoremoon/3cc622cc3266f55e683b to your computer and use it in GitHub Desktop.
/*
* judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0103&lang=jp
*
* AC
*/
#include <iostream>
#include <string>
using namespace std;
int main(){
int n = 0; cin >> n;
for (int i = 0; i < n; ++i) {
int outcount = 0, point = 0, runner = 0;
string input;
while ( outcount < 3 ) {
cin >> input;
if (input == "HIT") {
if (runner >= 3)
++point;
else
++runner;
} else if (input == "HOMERUN") {
point += runner + 1;
runner = 0;
} else {
++outcount;
}
}
cout << point << endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment