Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 끝말잇기
- #include <iostream>
- #include <cstring>
- using namespace std;
- #include <fstream>
- #include <cstdio>
- #include <cmath>
- #include <ctime>
- #include <vector>
- #include <stack>
- #include <queue>
- #include <functional>
- #include <deque>
- #include <numeric>
- #include <set>
- #include <climits>
- #include <utility>
- #include <map>
- #include <algorithm>
- #define INF 987654321
- #define MOD 1000000007
- typedef long long ll;
- typedef unsigned long long ull;
- inline int max( int x, int y ){ return x > y ? x : y ; }
- inline int min( int x, int y ){ return x < y ? x : y ; }
- inline ll max( ll x, ll y ){ return x > y ? x : y ; }
- inline ll min( ll x, ll y ){ return x < y ? x : y ; }
- inline ull max( ull x, ull y ){ return x > y ? x : y ; }
- inline ull min( ull x, ull y ){ return x < y ? x : y ; }
- int main(){
- int N;
- char input[10][11];
- scanf("%d", &N);
- memset( input, 0, sizeof(input) );
- fgetc(stdin);
- for( int i=0; i<N; ++i ){
- scanf("%s", input[i]);
- fgetc(stdin);
- }
- for( int i=0; i<N-1; ++i ){
- if( input[i][strlen(input[i])-1] != input[i+1][0] ){
- printf("NO");
- return 0;
- }
- }
- printf("YES");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement