Skip to content

Instantly share code, notes, and snippets.

@glowing713
Created July 18, 2019 12:02
Show Gist options
  • Save glowing713/edf2822571eafdec158e0705bd0b018a to your computer and use it in GitHub Desktop.
Save glowing713/edf2822571eafdec158e0705bd0b018a to your computer and use it in GitHub Desktop.
백준 8958번 OX퀴즈
#include <iostream>
#include <cstring>
using namespace std;
int main(void){
int num = 0, sum = 0, cnt = 0;
char ox[80];
cin >> num;
for(int i = 0; i < num; ++i){
cin >> ox;
for(int j = 0; j < strlen(ox); ++j){
if(ox[j] == 'O'){
++cnt;
sum += cnt;
}else if(ox[j] == 'X'){
cnt = 0;
}else{
cout << "Ooops! Wrong Input!" << endl;
return 0;
}
}
cout << sum << endl;
sum = 0;
cnt = 0;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment