108- import java.util.Scanner;
- public class JP108 {
- public static void main(String[] args) {
- // TODO 自動產生的方法 Stub
- Scanner s=new Scanner(System.in);
- int d=s.nextInt();
- double=d/2.0;
- double area=r*r*3.1415;
- System.out.printf("%-10\n%-10.2f\n%-10.4f",d,r,area);
- }
- }
複製代碼 105- import java.util.Scanner;
- public class JP105 {
- public static void main(String[] args) {
- // TODO 自動產生的方法 Stub
- Scanner sc= new Scanner(System.in);
- double a=sc.nextDouble();
- double b=sc.nextDouble();
-
- System.out.printf("result%.2f.Math.sqrt(a+b)"(a+b));
- }
- }
複製代碼 207- import java.util.Scanner
- public class JP207 {
- public static void main(String[] args) {
- Scanner s=new Scanner(System.in);
- int n=s.nextInt();
- for(int i=2;i<n;i++)
- {
- if(n%i==0){
- System.out.println(n+"is a prime number");
- return;
- }
- }
- System.out.println(n+"is not a prime number");
- }
- }
複製代碼 310- import java.util.Scanner;
- public class JP310 {
- static int compute(int n)
- {
- int total=0;
- for(int i=1;i<=n;i++){
- int sum=0;
- String str=String.valueOf(i);
- int len=str.length();
- for(int j=0;j<len;j++){
- int t=str.charAt(j)-'0';
- sum+=Math.pow(t,len);
- }
- if(sum==i){
- System.out.println(i);
- total+=i;
- }
- }
- return total;
- }
- public static void main(String[] args) {
-
- Scanner sc=new Scanner(System.in) ;
- int n=sc.nextInt();
- System.out.println(compute(n));
- }
- }
複製代碼 404- import java.util.Scanner;
- public class JP404 {
- public static void main(String[] args) {
- // TODO 自動產生的方法 Stub
- Scanner s=new Scanner(System.in);
-
- int[] sum=new int[26];
- int maxV=Integer.MIN_VALUE;
- char ans='0';
-
- String str;
- str=s.nextLine();
-
-
- for(int i=0;i<str.length();i++)
- {
- int c=str.charAt(i);
- sum[c-97]++;
- }
-
- for(int i=0;i<=25;i++)
- {
- if(sum[i]>maxV)
- {
- maxV=sum[i];
- ans=(char)(i+97);
- }
- }
- System.out.println(ans);
- System.out.println(maxV);
- }
-
- }
複製代碼 |