1을 걸려면 총 2초 필요 2로땡기면 3초걸리고
알파벳 UNUCIC 는 868242고 이때 몇초 걸리는지 표현
UNUCIC
36
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | import java.util.*; public class Main { public static void main(String[] args) { //97~122 아스키 a-z //65~90 대문자 A-Z //숫자 1에 2초 2에 3초 //S가 83 Scanner sc = new Scanner(System.in); String input = sc.nextLine().trim().toUpperCase(); String str = input; int cul =0; int sum=0; for(int i=0 ; i <str.length() ;i++) { // System.out.println(str.charAt(i)); cul = (int)str.charAt(i) ; // System.out.println(cul); if(cul >= 83) { cul-=1; if(cul >= 89) { cul-=1; } } cul-=65; cul/=3; // System.out.println(cul); cul= cul+3; // System.out.println(cul); sum+=cul; // System.out.println("###"); } System.out.println(sum); } } |
'오락기 > codeWar' 카테고리의 다른 글
백준 2438 별찍기 (0) | 2018.05.25 |
---|---|
백준 2941 크로아티아 알파벳 (0) | 2018.05.25 |
백준 2908 상수 (0) | 2018.05.25 |
백준 1157 단어공부 (0) | 2018.05.25 |
2675 백준 문자열반복 (0) | 2018.05.11 |