ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1110. Power

test_3
Posted by naaxall 22 Oct 2013 22:40
#include <stdio.h>
#include <math.h>

int main(void) {

    int N, M, Y;
    int i;
    int flag = 0;

    scanf("%d %d %d", &N, &M, &Y);

    for(i = 0; i < M; ++i) {
        if(fmod(pow(i, N), M) == Y) {
            printf("%d ", i);
            flag = 1;
        }
    }

    if(flag == 0) {
        printf("-1");
    }

    return 0;
}