Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #ifndef DEBUG
- #define DEBUG(...)printf(__VA_ARGS__)
- #endif
- int main()
- {
- int n,i,j,pot=0,pot2=0,pot3=0,pot4=0;
- scanf("%d", &n);
- int arr[n][n];
- if (n==0)
- return 0;
- //))))))))))))))))))))))))))))))))) unos
- for (i=0; i<n; i++){
- for (j=0; j<n; j++)
- {
- scanf("%d",&arr[i][j]);
- }
- }
- ///////////////////////////////////// glavna dijagonala
- for (i=0; i<n; i++){
- for (j=0; j<n; j++)
- {
- if(i==j){
- if(arr[i][j]==7)
- pot++;
- }
- }
- }
- //????????????????????????????????? sporedna dijagonala
- //for (i=0; i<n; i++){
- i=0;
- for (j=n-1; j>=0; j--)
- {
- if(arr[i][j] == 7){
- pot2++;
- i++;
- }
- }
- // }
- //================================= provjera redaka
- for (i=0; i<n; i++){
- for (j=0; j<n; j++)
- {
- if(j > 0){
- if((arr[i][j] == arr[i][j-1] == 7)
- printf("JACKPOT");
- }
- // if((arr[i][j]==arr[i][j+1]) == 7){
- // pot3++;
- // }
- }
- }
- //˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘˘ provjera stupaca
- for (i=0; i<n; i++){
- for (j=0; j<n; j++)
- {
- if((arr[i][j] == arr[i+1][j]) == 7){
- pot4++;
- }
- }
- }
- //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ispis
- if(pot == n){
- printf("JACKPOT");
- }else if(pot2==n){
- printf("JACKPOT");
- }else if(pot3 ==n){
- printf("JACKPOT");
- }else if(pot4==n){
- printf("JACKPOT");
- }else printf("GUBITNIK");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement