Blue___
코딩배우는 학생🌎
Blue___
전체 방문자
오늘
어제
  • 코딩배우는 학생🧀 (242)
    • Algorithms (145)
      • BOJ[Java] (107)
      • Programmers[Java] (32)
      • Coding_Contest (3)
    • Web (22)
      • .NET Core C# (2)
      • Java (1)
      • Oracle SQL (7)
      • Web-ProJect (3)
      • Error처리 (1)
      • Web지식 (4)
      • Javascript (1)
      • Vue (3)
    • Git (4)
    • Java_beginner(Repl.it) (55)
      • Auto-Graded-Course(AP CS A) (54)
    • 프로젝트 직딩일기 (3)
    • Hanyang_Assignment (0)
    • 이모저모 (4)
      • 잡담 (1)
      • 2021 오픈소스 컨트리뷰터 아카데미 (1)
      • DDD - 6기! (1)
    • 북리뷰 (1)
      • 리팩토링 2판 (1)
      • 클린코드 (0)

블로그 메뉴

  • 🐰GITHUB
  • ☘️포트폴리오
  • 🌸MBC개발_투표 2022
  • 🍭MBC_APP

공지사항

인기 글

태그

  • programmers
  • REPL
  • repl.it
  • 자바
  • Bakjoon
  • java basic
  • auto-graded course
  • 알고리즘
  • algorithm
  • 프로그래밍
  • 코딩
  • coding
  • 백준
  • 코딩배우는 학생
  • AP CS A
  • Java tutorial
  • 프로그래머스
  • Java
  • 레플릿
  • 코딩배우는학생

최근 댓글

최근 글

티스토리

hELLO
Blue___

코딩배우는 학생🌎

[백준/17009번] Winning Score  ( CCC 2019 Junior Division)[Java]
Algorithms/BOJ[Java]

[백준/17009번] Winning Score ( CCC 2019 Junior Division)[Java]

2019. 12. 9. 16:40

Problem

You record all of the scoring activity at a basketball game. Points are scored by a 3-point shot, a 2-point field goal, or a 1-point free throw.

You know the number of each of these types of scoring for the two teams: the Apples and the Bananas. Your job is to determine which team won, or if the game ended in a tie.

Input

The first three lines of input describe the scoring of the Apples, and the next three lines of input describe the scoring of the Bananas. For each team, the first line contains the number of successful 

Output

The output will be a single character. If the Apples scored more points than the Bananas, output 'A'. If the Bananas scored more points than the Apples, output 'B'. Otherwise, output 'T', to indicate a tie.

 


Solution

기본문제.ㅇㅅㅇ

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
import java.util.*;
import java.io.*;
import java.text.SimpleDateFormat;
 
 
class Bakjoon {
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);            
       int sum=0;
       int cnt=3;
       int sum1=0;
       for(int i=1;i<7;i++) {
           int a=sc.nextInt();
           sum+= a*cnt;
           cnt--;
           if(i==3) {
               sum1=sum;
               cnt=3;
               sum=0;
       }      
    }
       if(sum1==sum) {
           System.out.println("T");
       }
       else {
           System.out.println(sum1>sum?"A":"B");
       }
}
}
    
 
 

https://www.acmicpc.net/problem/17009

 

17009번: Winning Score

The output will be a single character. If the Apples scored more points than the Bananas, output 'A'. If the Bananas scored more points than the Apples, output 'B'. Otherwise, output 'T', to indicate a tie.

www.acmicpc.net

 

반응형
저작자표시 (새창열림)

'Algorithms > BOJ[Java]' 카테고리의 다른 글

[백준/5612번] 터널의 입구와 출구(JOI 2006 모의고사 2)[Java]  (0) 2019.12.10
[백준/5585번] 거스름돈 (JOI 2008 예선)[Java]  (0) 2019.12.10
[백준/13597번] Tri-du( A Primeira Fase da Maratona de Programação 2015) [Java]  (0) 2019.12.09
[백준/11319번] Count Me In (CCPC 2015 Division 2) [Java]  (0) 2019.12.09
[백준/11104번] Fridge of Your Dreams ( IDI Open 2007 )[Java]  (0) 2019.12.09
    'Algorithms/BOJ[Java]' 카테고리의 다른 글
    • [백준/5612번] 터널의 입구와 출구(JOI 2006 모의고사 2)[Java]
    • [백준/5585번] 거스름돈 (JOI 2008 예선)[Java]
    • [백준/13597번] Tri-du( A Primeira Fase da Maratona de Programação 2015) [Java]
    • [백준/11319번] Count Me In (CCPC 2015 Division 2) [Java]
    Blue___
    Blue___
    완전 연소한 불은 재를 남기지않는다 : 코딩배우는학생 🌎

    티스토리툴바