fork download
  1. // Question-10 Beautiful Array
  2.  
  3. #include <stdio.h>
  4.  
  5. int beauty(int *beauty_2, int m)
  6. {
  7. int beauty_1 = 0;
  8.  
  9. for (int i = 0; i < m; i++)
  10. {
  11.  
  12. while (beauty_2[i] != 0)
  13. {
  14.  
  15. int beauty_3 = beauty_2[i] % 10;
  16.  
  17. if (beauty_3 == 7)
  18. {
  19.  
  20. beauty_1++;
  21.  
  22. break;
  23. }
  24.  
  25. beauty_2[i] /= 10;
  26. }
  27. }
  28.  
  29. return beauty_1;
  30. }
  31. int main()
  32. {
  33.  
  34. int n;
  35. scanf("%d", &n);
  36. int beauty_2[n];
  37.  
  38. for (int j = 0; j < n; j++)
  39. {
  40. scanf("%d", &beauty_2[j]);
  41. }
  42. if (beauty(&beauty_2, n) >= 3)
  43. {
  44. printf("Beautiful");
  45. }
  46. else
  47. {
  48. printf("Ugly");
  49. }
  50. }
  51.  
Success #stdin #stdout 0s 5512KB
stdin
6
33 1 17 171 88 734
stdout
Beautiful