# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
864339 | gutzzy | Imena (COCI16_imena) | C++14 | 1 ms | 608 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
bool name(string s){
bool first = true;
for(char c:s){
if(isdigit(c)) return false;
if(first){
if(c != toupper(c)) return false;
}
else{
if(c != tolower(c)) return false;
}
first = false;
}
return true;
}
int main(){
int n;
cin >> n;
//cout << toupper('c') << toupper('C') << tolower('C') << endl;
//cout << name("Hola")<<endl;
//<< " " << name("a4") << " " << name("4a") << " " << name("ajs") << endl;
for(int xx=0;xx<n;xx++){
string s;
vector<string> sentence;
cin >> s;
while(s[s.size()-1]!='.' and s[s.size()-1]!='?' and s[s.size()-1]!='!'){
sentence.push_back(s);
cin >> s;
}
sentence.push_back(s.substr(0,s.size()-1));
int c=0;
for(string word:sentence){
if(name(word)) c++;
}
cout << c << endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |