답안 #94819

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
94819 2019-01-24T08:58:27 Z AKaan37 Imena (COCI16_imena) C++14
50 / 50
2 ms 504 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair<int,int> PII;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR for(int i=1;i<=  n;i++)
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mid (start+end)/2

const lo mod = 1000000007;
const lo li = 100005;
const lo inf = 1000000000;
const lo MAX = 1000000000000000000;
const lo MIN = -1000000000000000000;
const lo LOG = 30;

int n,m,cev,gol;
string s;

int main(){
	scanf("%d",&n);
	while(n>0){
		gol++;
		cin>>s;
		int flag=0;
		m=s.size();
		if(s[m-1]=='.' || s[m-1]=='!' || s[m-1]=='?'){
			if(s[0]>='A' && s[0]<='Z'){
				for(int j=1;j<m-1;j++){
					if(s[j]<'a' || s[j]>'z'){flag=1;break;}
				}
				if(flag==0){cev++;}
			}
			printf("%d\n",cev);
			cev=0;
			n--;
			continue;
		}
		else{
			if(s[0]>='A' && s[0]<='Z'){
				for(int j=1;j<m;j++){
					//~ if(gol==1){cout<<s[j]<<endl;}
					if(s[j]<'a' || s[j]>'z'){flag=1;break;}
				}
				if(flag==0){cev++;}
			}
		}
	}
	return 0;
}

Compilation message

imena.cpp: In function 'int main()':
imena.cpp:27:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct