티스토리 뷰
반응형
문제
시험 점수를 입력받아 90 ~ 100점은 A, 80 ~ 89점은 B, 70 ~ 79점은 C, 60 ~ 69점은 D, 나머지 점수는 F를 출력하는 프로그램을 작성하시오.
입력
첫째 줄에 시험 점수가 주어진다. 시험 점수는 0보다 크거나 같고, 100보다 작거나 같은 정수이다.
출력
시험 성적을 출력한다.
예제입력
100
예제 출력
A
문제풀이
//입력값 받기, 같은 폴더내에 input.txt 생성
const fs = require('fs');
const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt';
let input = fs.readFileSync(filePath).toString().split(' ');
solution(input[0]);
function solution(A) {
A = parseInt(A);
if(0<=A&&A<=100){
switch(parseInt(A/10)){
case 10 : console.log('A');
break;
case 9 : console.log('A');
break;
case 8 : console.log('B');
break;
case 7 : console.log('C');
break;
case 6 : console.log('D');
break;
default : console.log('F');
break;
}
}
}
출처
https://www.acmicpc.net/problem/9498
9498번: 시험 성적
시험 점수를 입력받아 90 ~ 100점은 A, 80 ~ 89점은 B, 70 ~ 79점은 C, 60 ~ 69점은 D, 나머지 점수는 F를 출력하는 프로그램을 작성하시오.
www.acmicpc.net
반응형
'Algorithm' 카테고리의 다른 글
[JavaScript ] BeakJoon 2884 알람시계 (0) | 2021.08.04 |
---|---|
[JavaScript ] BeakJoon 2753 윤년 (0) | 2021.08.04 |
[JavaScript ] BeakJoon 1330 두 수 비교하기 (0) | 2021.08.04 |
[JavaScript ] BeakJoon 10172 개 (0) | 2021.07.25 |
[JavaScript ] BeakJoon 10171 고양이 (0) | 2021.07.23 |
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- see ec2 instance connect prerequisites at https://docs.aws.amazon.com/awsec2/latest/userguide #인스턴스 연결 안됨
- ec2 instance connect is unable to connect to your instance. ensure your instance network settings are configured correctly for ec2 instance connect. for more information
- Express multer #Express File 저장 #node.js
- react #react-spinners #modal loading #overlay #로딩창 #react 로딩창 만들기
- react #img 전송
- mysql date between performance
- docker # docker build # m1 docker build
- node.js #node.js pdf만들기 #node.js pdfkit
- mysql date between # mysql date between 대소 비교 연산자
- docker mysql
- reack-cookies #아이디 저장하기 #react 아이디 저장 #react cookie #리엑트 아이디 저장하기
- FormData #FormData 파일전송 #FormData append json # React FormData File #React FormData append Json
- Mac docker.for.mac.host.internal
- Pytorch #Yolov5 #Segementation
- Procedure #mysql #mysql Procedure #mysql 반복문 #Procedure 반복문 #mysql insert 반복문
- mysql date
- excel 파일 만들기 #node.js #express excel 파일 만들기 #데이터 입력해서 excel 파일 만들기
- node.js 파일 저장
- React filter #js Includes #React Filter includes
- ERROR: failed to solve: no support for running processes with linux/amd64/v3 platform
- BOJ #JS
- JavaScript #Programmers #lvl2 #프로그래머스 오픈채팅방 # 오픈채팅방 문제
- supported: linux/amd64
- AWS #인바운드 #SSH #인스턴스 연결
- linux/amd64/v2
- 이미지 전송 # 이미지 업로드 #이미지 여러장 #이미지 여러장 업로드 #react 이미지 업로드 #react 이미지 여러장 업로드
- PDF #pdfkit
- Swal #sweetalert2 #alert #알림창 띄우기 #react swal
- mysql date type
- PoolCluster : Error: connect ECONNREFUSED 127.0.0.1:3306)
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함