Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. #ifndef DEBUG
  4. #define DEBUG(...)printf(__VA_ARGS__)
  5. #endif
  6.  
  7. int main()
  8. {
  9. int n,i,j,pot=0,pot2=0,pot3=0,pot4=0;
  10. scanf("%d", &n);
  11. int arr[n][n];
  12. if (n==0)
  13. return 0;
  14. //))))))))))))))))))))))))))))))))) unos
  15. for (i=0; i<n; i++){
  16. for (j=0; j<n; j++)
  17. {
  18. scanf("%d",&arr[i][j]);
  19. }
  20. }
  21. ///////////////////////////////////// glavna dijagonala
  22. for (i=0; i<n; i++){
  23. for (j=0; j<n; j++)
  24. {
  25. if(i==j){
  26. if(arr[i][j]==7)
  27. pot++;
  28. }
  29. }
  30.  
  31. }
  32. //????????????????????????????????? sporedna dijagonala
  33. //for (i=0; i<n; i++){
  34. i=0;
  35.  
  36. for (j=n-1; j>=0; j--)
  37. {
  38. if(arr[i][j] == 7){
  39. pot2++;
  40. i++;
  41. }
  42. }
  43. // }
  44. //================================= provjera redaka
  45. for (i=0; i<n; i++){
  46. for (j=0; j<n; j++)
  47. {
  48. if(j > 0){
  49. if((arr[i][j] == arr[i][j-1] == 7)
  50. printf("JACKPOT");
  51.  
  52. }
  53.  
  54. // if((arr[i][j]==arr[i][j+1]) == 7){
  55. // pot3++;
  56. // }
  57.  
  58. }
  59. }
  60. //˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘ provjera stupaca
  61. for (i=0; i<n; i++){
  62. for (j=0; j<n; j++)
  63. {
  64. if((arr[i][j] == arr[i+1][j]) == 7){
  65. pot4++;
  66. }
  67.  
  68. }
  69. }
  70. //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ispis
  71. if(pot == n){
  72. printf("JACKPOT");
  73. }else if(pot2==n){
  74. printf("JACKPOT");
  75. }else if(pot3 ==n){
  76. printf("JACKPOT");
  77. }else if(pot4==n){
  78. printf("JACKPOT");
  79. }else printf("GUBITNIK");
  80. return 0;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement