Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- #include <math.h>
- int rek(int broj, int stepen, int x) {
- if(broj == stepen) {
- return 1;
- }
- if(stepen > broj) {
- return 0;
- }
- return rek(broj, stepen * x, x);
- }
- int main() {
- int n;
- scanf("%d", &n);
- int a, b;
- for(int i = 0; i < n; i++) {
- scanf("%d%d", &a, &b);
- if(b <= 1) {
- if(a == b) {
- printf("DA\n");
- }
- else {
- printf("NE\n");
- }
- }
- else {
- if(rek(a, 1, b) == 1) {
- printf("DA\n");
- }
- else {
- printf("NE\n");
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement