符号化基礎100題(21-30)

3786 ワード


1021
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        System.out.print(str);
    }
}
1022
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        System.out.print(str);
    }
}
1023
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        StringTokenizer st = new StringTokenizer(str, ".");
        while(st.hasMoreTokens()){
            System.out.println(st.nextToken());
        }
    }
}
1024
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int len = str.length();
        for(int i=0; i<len; i++){
            System.out.println("'" + str.charAt(i) + "'");
        }
    }
}
1025
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String num = sc.next();
        int len = num.length();

        for(int i=0; i<len; i++){
            int n = (int) ((int)Integer.parseInt(String.valueOf(num.charAt(i)))* Math.pow(10,len-1-i));
            System.out.println("[" + n + "]");
        }
    }
}
1026
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String time = sc.next();
        StringTokenizer st = new StringTokenizer(time, ":");
        String[] arr = new String[3];
        int i=0;
        while(st.hasMoreTokens()){
            arr[i] = st.nextToken();
            i++;
        }
        System.out.print(Integer.parseInt(arr[1]));
    }
}
1027
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String time = sc.next();
        StringTokenizer st = new StringTokenizer(time, ".");
        String[] arr = new String[3];
        int i=0;
        while(st.hasMoreTokens()){
            arr[i] = st.nextToken();
            i++;
        }
        System.out.print(arr[2] + "-" + arr[1] + "-" + arr[0]);
    }
}
1028
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long num = sc.nextLong();
        System.out.print(num);
    }
}
1029
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Double num = sc.nextDouble();
        System.out.format("%.11f",num);
    }
}
1030
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long num = sc.nextLong();
        System.out.print(num);
    }
}