Advertisement
Josif_tepe

Untitled

Dec 24th, 2020
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5. int rekurzija1(int x, int y, int stepen) {
  6.     if(x == y) {
  7.    
  8.         return 1;
  9.     }
  10.     if(y > x) {
  11.         return 0;
  12.     }
  13.     return rekurzija1(x, y * stepen, stepen);
  14. }
  15. int main()
  16. {
  17.     int n;
  18.     scanf("%d", &n); // n parovi
  19.     for(int i = 0; i < n; i++) {
  20.         int x, y;
  21.         scanf("%d%d", &x, &y);
  22.         if(y == 0) {
  23.             printf("NE\n");
  24.             continue;
  25.         }
  26.         if(x != 1 && y == 1) {
  27.             printf("NE\n");
  28.             continue;
  29.         }
  30.         if(rekurzija1(x, y, y) == 1) {
  31.             printf("DA\n");
  32.         }
  33.         else {
  34.             printf("NE\n");
  35.         }
  36.        
  37.     }
  38.     return 0;
  39. }
  40.    
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement