Created
July 18, 2019 12:02
-
-
Save glowing713/edf2822571eafdec158e0705bd0b018a to your computer and use it in GitHub Desktop.
백준 8958번 OX퀴즈
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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