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

Please Help me, WA#6
Posted by YPedorenko[VNTU] 18 Aug 2012 04:34
This is my code

#include <iostream>

using namespace std;

long long sqr_N(int arg, int Step)
{
    long long Result = 1;
    for(int i=1; i<=Step; i++)
        Result *= arg;
    return Result;
}
int main()
{
    int N,M,Y;
    bool check = false;

    cin >> N >> M >> Y;

    for(int X=0; X<M; X++)
    {
        if(sqr_N(X,N)%M == Y)
        {
            cout << X << ' ';
            check = true;
        }
    }
    if(!check) cout << -1;

    return 0;
}


--------------------------
I can't understand WHY WA#6
Help me somebody
Re: Please Help me, WA#6
Posted by NiF 27 Oct 2012 00:42
Maximum value of type long long is 2^63-1 less than 998^999