답안 #293948

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
293948 2020-09-08T14:00:22 Z 7_7_7 Imena (COCI16_imena) C++17
50 / 50
1 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

int n;
bool good(string s){
    if(s.back() == '.') s.pop_back();
    if(s.back() == '?') s.pop_back();
    if(s.back() == '!') s.pop_back();
    if('A' <= s[0] && s[0] <= 'Z'){
        for(int i = 1; i < (int)s.size(); i ++){
            if('a' <= s[i] && s[i] <= 'z') continue;
            return false;
        }
        return true;
    }
    return false;
}
int main()
{
    ios_base::sync_with_stdio(false);

    cin >> n;
    vector<int> res;
    for(int i = 1; i <= n; i ++){
        string s;
        int cnt = 0;
        while(true){
            cin >> s;
            cnt += (good(s) == true);
            if(s.back() == '.' || s.back() == '?' || s.back() == '!') break;
        }
        res.push_back(cnt);
    }
    for(auto x: res) cout << x << "\n";
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct