| 
 | 
вернуться в форумPascal - AC, but Java - WA In Pascal I have AC, but in Java - WA, why??   /* package whatever; // don't place package name! */   import java.util.*; import java.lang.*; import java.io.*;   /* Name of the class has to be "Main" only if the class is public. */ public class Ideone {     public static void main (String[] args) throws java.lang.Exception     {         Scanner in = new Scanner(System.in);         PrintWriter out = new PrintWriter(System.out);
          int N, M, Y = 0;         boolean check = false;
          N = in.nextShort();         M = in.nextShort();         Y = in.nextShort();
          double p;
          if ( ((0<N) && (N<999)) && ((1<M) && (M<999)) && ((0<Y) && (Y<999)) ) {             for (int X=0; X<=M-1; ++X) {                 p = ((Math.pow(X,N)) % M);                 if (p == Y) {                     if (X != (M-2)) {                         out.print(X + " ");                     } else {                         out.print(X);                     }                     check = true;                 }             }         }
          if (!check) {             out.print("-1");         }
          out.flush();     } }  |  
  | 
|