标签:sqrt false ring exti mat gcd return port out
注意行末空格。
import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.Character;
public class Main
{
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
int[] arr=new int[10];
for(int i=0;i!=10;++i)
arr[i]=cin.nextInt();
for(int i=9;i>=0;--i)
{
System.out.print(arr[i]);
if(i!=0) System.out.print(" ");
else System.out.print("\n");
}
}
}
import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.Character;
public class Main
{
static int gcd(int x,int y)
{
if(y==0) return x;
else return gcd(y, x%y);
}
static int lcm(int x,int y)
{
return x/gcd(x,y)*y;
}
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
int x=cin.nextInt(),y=cin.nextInt();
System.out.println(String.valueOf(gcd(x,y))+" "+String.valueOf(lcm(x,y)));
}
}
import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.Character;
public class Main
{
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
double a=cin.nextDouble(),b=cin.nextDouble(), c=cin.nextDouble();
double delta=b*b-4*a*c;
if(Math.abs(delta)>1e-6 && delta<0)
{
System.out.printf("x1=%.3f+%.3fi x2=%.3f-%.3fi\n", -b/2/a,
Math.sqrt(-delta)/2/a, -b/2/a, Math.sqrt(-delta)/2/a);
}
else
{
System.out.printf("x1=%.3f x2=%.3f\n", -b/2/a-Math.sqrt(-delta)/2/a,
-b/2/a-Math.sqrt(delta)/2/a);
}
}
}
import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.Character;
public class Main
{
static void judge_prime(int x)
{
boolean ok=true;
if(x==1) ok=false;
else
{
for(int i=2; i*i<=x; ++i)
{
if(x%i==0)
{
ok=false;
break;
}
}
}
if(ok)
System.out.println("prime");
else
System.out.println("not prime");
}
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
int a=cin.nextInt();
judge_prime(a);
}
}
import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.Character;
public class Main
{
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
int[][] arr=new int[3][3];
for(int i=0;i!=3;++i)
for(int j=0;j!=3;++j)
arr[i][j]=cin.nextInt();
for(int j=0;j!=3;++j)
{
for(int i=0;i!=3;++i)
{
System.out.print(arr[i][j]);
System.out.print(" ");
}
System.out.print("\n");
}
}
}
import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.Character;
public class Main
{
public static void main(String args[])
{
Scanner cin=new Scanner(System.in);
String a=cin.next();
String reverse=new StringBuffer(a).reverse().toString();
System.out.println(reverse);
}
}
标签:sqrt false ring exti mat gcd return port out
原文地址:https://www.cnblogs.com/samhx/p/9972594.html