提出 #76044180


ソースコード 拡げる

import java.util.*;

public class Main
{
	public static void main(String[] args) {
	    
	    Scanner sc = new Scanner(System.in);
	    
	    int num = sc.nextInt();
	    sc.nextLine();
	    StringBuilder sb = new StringBuilder();
	    
	    String[] arr = (sc.nextLine()).split(" ");
	    
	    for(int i = 0; i<num; i++){
	        String s = arr[i];
	        
	        char c = s.charAt(0);
	        
	        if(c == 'a' || c == 'b' || c == 'c'){
	            sb.append('2');
	        } 
	        else if(c == 'd' || c == 'e' || c == 'f'){
	            sb.append('3');
	        }
	        else if(c == 'g' || c == 'h' || c == 'i'){
	            sb.append('4');
	        }
	        else if(c == 'j' || c == 'k' || c == 'l'){
	            sb.append('5');
	        }
	        else if(c == 'm' || c == 'n' || c == 'o'){
	            sb.append('6');
	        }
	        else if(c == 'p' || c == 'q' || c == 'r' || c == 's'){
	            sb.append('7');
	        }
	        else if(c == 't' || c == 'u' || c == 'v'){
	            sb.append('8');
	        }
	        else {
	            sb.append('9');
	        }
	    }
	    
		System.out.println(sb.toString());
	}
}

提出情報

提出日時
問題 B - 459
ユーザ jayeshsolanki
言語 Java24 (OpenJDK 24.0.2)
得点 200
コード長 1212 Byte
結果 AC
実行時間 79 ms
メモリ 40772 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 2
AC × 20
セット名 テストケース
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 79 ms 40380 KiB
example_01.txt AC 66 ms 40128 KiB
hand_00.txt AC 68 ms 40108 KiB
hand_01.txt AC 68 ms 40400 KiB
hand_02.txt AC 69 ms 40448 KiB
hand_03.txt AC 68 ms 40436 KiB
hand_04.txt AC 69 ms 40340 KiB
hand_05.txt AC 66 ms 39896 KiB
random_00.txt AC 69 ms 40460 KiB
random_01.txt AC 67 ms 40112 KiB
random_02.txt AC 68 ms 40024 KiB
random_03.txt AC 69 ms 40224 KiB
random_04.txt AC 69 ms 40772 KiB
random_05.txt AC 68 ms 40116 KiB
random_06.txt AC 68 ms 39900 KiB
random_07.txt AC 66 ms 39900 KiB
random_08.txt AC 65 ms 40116 KiB
random_09.txt AC 69 ms 40712 KiB
random_10.txt AC 68 ms 40092 KiB
random_11.txt AC 67 ms 39932 KiB