| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
程序如下,帮忙挑错(JAVA)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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator