Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

程序如下,帮忙挑错(JAVA)

Posted by vegetables at 2007-06-17 17:31:34 on Problem 1061
public class ACM_01 {
    
    /** Creates a new instance of ACM_01 */
    public ACM_01() {
    }
    public int times =0;
    public void method(int x,int y,int m,int n,int l) {
        if(x == y&&m!=n) {
            System.out.println(""+times);
        }
        if(m == n) {
            System.out.println("Impossible");
        }
        if(x!=y&&m != n) {
            if(x + m / l == 0) {
                x = x + m;
            } else {
                x = (x+m)%l;
            }
            if(y + n / l == 0) {
                y = y + n;
            } else {
                y = (y+n)%l;
            }
            times++;
            method(x,y,m,n,l);
        }
    }
    
    public static void main(String[] args) {
        ACM_01 a = new ACM_01();
        a.method(1,2,3,4,5);
    }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator