# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
23067 | 2017-05-02T15:13:33 Z | model_code | Imena (COCI16_imena) | C++11 | 0 ms | 2020 KB |
#include <iostream> #include <string> using namespace std; bool jeInterZnak( char c ) { return c == '.' || c == '?' || c == '!'; } bool imaInterZnakNaZadnjemMjestu( string rijec ) { return jeInterZnak( rijec[ rijec.size()-1 ] ); } bool jeIme( string rijec ) { // ako prvo slovo nije veliko slovo engleske abecede if( rijec[ 0 ] < 'A' || rijec[ 0 ] > 'Z' ) { return false; } for( int i = 1; i < rijec.size(); ++i ) { if( (rijec[ i ] < 'a' || rijec[ i ] > 'z') && jeInterZnak(rijec[ i ]) == false ) { return false; } } return true; } int main () { int n; cin >> n; for( int i = 0; i < n; ++i ) { int cnt = 0; string rijec; do { cin >> rijec; if( jeIme( rijec ) ) { ++cnt; } } while( imaInterZnakNaZadnjemMjestu( rijec ) == false ); cout << cnt << endl; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2020 KB | Output is correct |
2 | Correct | 0 ms | 2020 KB | Output is correct |
3 | Correct | 0 ms | 2020 KB | Output is correct |
4 | Correct | 0 ms | 2020 KB | Output is correct |
5 | Correct | 0 ms | 2020 KB | Output is correct |
6 | Correct | 0 ms | 2020 KB | Output is correct |
7 | Correct | 0 ms | 2020 KB | Output is correct |
8 | Correct | 0 ms | 2020 KB | Output is correct |
9 | Correct | 0 ms | 2020 KB | Output is correct |
10 | Correct | 0 ms | 2020 KB | Output is correct |