package aa;
import java.math.*;
import java.util.Scanner;
public class demo1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int time = input.nextInt();
int command = input.nextInt();
int x = 0;
int y = 0;
int angle = 90;
for(int i=0;;i++){
if(command==3) break;
else if(command==1) angle+=90;
else angle-=90;
if(angle==90) x+=90*time;
else if(angle==180)
}
}
}
1073鸡兔同笼问题
1.判断某数是否为整数:
Math.round(n) == n;
if(n%1==0)
2.又错了
package aa;
import java.math.*;
import java.util.Scanner;
public class demo1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int tou = input.nextInt();
int jiao = input.nextInt();
double tu = (jiao - 2*tou)/2;
double ji = tou - tu;
// if(Math.round(tu) == tu && Math.round(tou) == tou && tu>=0 && ji>=0) System.out.println((int)ji+" "+(int)tu);
// else System.out.println("No Answer");
if(jiao-2*tou>=0) System.out.println((int)ji+" "+(int)tu);
else System.out.println("No Answer");
}
}
Java中判断字符串是否为数字的五种方法 - 来杯咖啡,随便聊聊。 - ITeye博客这个需要再看看
1074卡很久,不做啦