62,623
社区成员
发帖
与我相关
我的任务
分享
package B;
import A.a;
public class b extends a {
public static void main(String[] args) {
//
final int ji = 2;
final int tu = 4;
for (int i = 1; i < 30; i++) {
int ii = (90 - 2 * i) % 4;
int a = (90 - 2 * i) / 4;
int b = i + a;
if ((ii == 0) && (b == 30)) {
System.out.println("ji====" + i + " tuzi======" + (30 - i));
}
}
}
}
public class Test
{
public static void main(String[] args)
{
int sum = 30;
int legs = 91;
int i = sum/2;
int j = sum-i;
int flag = 0;
while(true)
{
if((i*2 + j*4) == legs) break;
if((i*2 + j*4) > legs)
{
i++;
j--;
flag ++;
}
else {
i--;
j++;
flag ++;
}
if(flag == 2) break;
}
if(flag!=2)
System.out.println("i,j :"+i+","+j);
else {
System.out.println("无解");
}
}
}public class Test
{
public static void main(String[] args)
{
int sum = 30;
int legs = 90;
int i = sum/2;
int j = sum-i;
while(true)
{
if((i*2 + j*4) == legs) break;
if((i*2 + j*4) > legs)
{
i++;
j--;
}
else {
i--;
j++;
}
}
System.out.println("i,j :"+i+","+j);
}
}public class Number {
private int x,y;
/**
* Creates a new instance of <code>Number</code>.
*/
public Number(int x,int y) {
this.x=x;
this.y=y;
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
new Number(30,60).number();
}
public void number(){
System.out.println ("rabbit="+(y/2-x));
System.out.println ("chicken="+(2*x-y/2));
}
}