๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Algorithm/CodeUp ๊ธฐ์ดˆ 100์ œ

[์ฝ”๋“œ์—… ๊ธฐ์ดˆ 100์ œ-JAVA] 1071~1080๋ฒˆ

by ์ฝ”๋”ฉํ•˜๋Š” ๋ถ•์–ด 2023. 3. 4.
๋ฐ˜์‘ํ˜•

1071๋ฒˆ

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] a = br.readLine().split(" ");
        br.close();

        PrintWriter pw = new PrintWriter(System.out);
        for (int i = 0; i < a.length; i++) {
            if (a[i].equals("0")) {
                break;
            } else {
                pw.println(a[i]);
            }
        }
        pw.flush();
        pw.close();
    }
}

 

 

1072๋ฒˆ (์‹คํ–‰์ค‘ ์—๋Ÿฌ๊ฐ€ ๋œธ;;)

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] arr = new int[n];

        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(br.readLine());
        }

        for (int i = 0; i < n; i++) {
            System.out.println(arr[i]);
        }
    }
}

์ธํ…”๋ฆฌ์ œ์ด์—์„œ ๋Œ๋ฆฌ๋ฉด ์ •์ƒ์ ์œผ๋กœ ๋‚˜์˜ค๋Š”๋ฐ ๋ญ์ง€? ์™œ ์ด๋Ÿฌ๋Š”์ง€ ์•„์‹œ๋Š”๋ถ„...?

 

 

1073๋ฒˆ

import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] a = br.readLine().split(" ");
        
        for (int i = 0; i < a.length; i++) {
            if (a[i].equals("0")) {
                break;
            } else {
                System.out.println(a[i]);
            }
        }
    }
}

 

 

1074๋ฒˆ

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int a = Integer.parseInt(st.nextToken());
        br.close();

        while (true) {
            if (a == 0) break;
            System.out.println(a);
            a--;
        }
    }
}

 

 

1075๋ฒˆ

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int a = Integer.parseInt(st.nextToken());
        br.close();

        while (true) {
            if (a <= 0)
                break;
            System.out.println(a - 1);
            a--;
        }
    }
}

 

 

1076๋ฒˆ

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char a = br.readLine().charAt(0);

        for (char i = 'a'; i <= a; i++) {
            System.out.print(i + " ");
        }
    }
}

 

 

1077๋ฒˆ

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int a = Integer.parseInt((st.nextToken()));
        br.close();

        for (int i = 0; i <= a; i++) {
            System.out.println(i);
        }
    }
}

 

 

1078๋ฒˆ

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int a = Integer.parseInt((st.nextToken()));
        int result = 0;
        br.close();

        for (int i = 0; i <= a; i++) {
            if (i % 2 == 0) {
                result += i;
            }
        }
        System.out.println(result);
    }
}

 

 

1079๋ฒˆ

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] a = br.readLine().split(" ");
        br.close();

        for (int i = 0; i < a.length; i++) {
            System.out.println(a[i]);

            if (a[i].equals("q")) {
                break;
            }
        }
    }
}

 

 

1080๋ฒˆ

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int a = Integer.parseInt(st.nextToken());
        int sum = 0;
        br.close();

        for (int i = 1; i <= a; i++) {
            sum = sum += i;
            if (sum >= a) {
                System.out.println(i);
                break;
            }
        }
    }
}
๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€