반응형

1076번

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

		char word = (char) br.read();

		for (char i = 'a'; i <= word; i++) {
			bw.write(String.valueOf((i)) + " ");
		}

		bw.flush();
		bw.close();

	}
}

 

1077번

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

		StringBuilder sb = new StringBuilder();

		int count = Integer.parseInt(br.readLine());

		for (int i = 0; i <= count; i++) {
			sb.append(String.valueOf(i) + "\n");
		}
		sb.deleteCharAt(sb.length() - 1);
		bw.write(sb.toString());
		bw.flush();
		bw.close();

	}
}

 

1078번

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

		int count = Integer.parseInt(br.readLine());
		int sum = 0;
		for (int i = 0; i <= count; i++) {
			if (i % 2 == 0) {
				sum = sum + i;
			}
		}

		bw.write(String.valueOf(sum));
		bw.flush();
		bw.close();

	}
}

 

1079번

import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner scan = new Scanner(System.in);

		while (true) {
			String word = scan.next();
			if (word.equals("q")) {
				System.out.println(word);
				break;
			} else {
				System.out.println(word);
			}
		}
		scan.close();
	}
}

 

1080번

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

		int count = Integer.parseInt(br.readLine());
		int n = 1;

		while ((n * (n + 1)) / 2 < count) {
			n++;
		}

		bw.write(String.valueOf(n));
		bw.flush();
		bw.close();

	}
}

 

반응형

+ Recent posts