Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. // 끝말잇기
  2.  
  3. #include <iostream>
  4. #include <cstring>
  5. using namespace std;
  6. #include <fstream>
  7. #include <cstdio>
  8. #include <cmath>
  9. #include <ctime>
  10. #include <vector>
  11. #include <stack>
  12. #include <queue>
  13. #include <functional>
  14. #include <deque>
  15. #include <numeric>
  16. #include <set>
  17. #include <climits>
  18. #include <utility>
  19. #include <map>
  20. #include <algorithm>
  21. #define INF 987654321
  22. #define MOD 1000000007
  23. typedef long long ll;
  24. typedef unsigned long long ull;
  25. inline int max( int x, int y ){ return x > y ? x : y ; }
  26. inline int min( int x, int y ){ return x < y ? x : y ; }
  27. inline ll max( ll x, ll y ){ return x > y ? x : y ; }
  28. inline ll min( ll x, ll y ){ return x < y ? x : y ; }
  29. inline ull max( ull x, ull y ){ return x > y ? x : y ; }
  30. inline ull min( ull x, ull y ){ return x < y ? x : y ; }
  31.  
  32.  
  33. int main(){
  34.  
  35. int N;
  36. char input[10][11];
  37.  
  38. scanf("%d", &N);
  39. memset( input, 0, sizeof(input) );
  40.  
  41. fgetc(stdin);
  42. for( int i=0; i<N; ++i ){
  43. scanf("%s", input[i]);
  44. fgetc(stdin);
  45. }
  46.  
  47. for( int i=0; i<N-1; ++i ){
  48. if( input[i][strlen(input[i])-1] != input[i+1][0] ){
  49. printf("NO");
  50. return 0;
  51. }
  52. }
  53. printf("YES");
  54. return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement