CODE FESTIVAL 2016 qual A

Submission #1220949

Source codeソースコード

import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		String string = cin.next();
		int K = cin.nextInt();
		//贪心算法的最佳体现
		int i;
		for (i=0;i<string.length()-1;i++){
			//最后一个字符要单独处理
			char c = string.charAt(i);
			if (K < 'z' - c + 1) {
				System.out.print(c);
				continue;
			}
			System.out.print('a');
			K -= 'z' - c + 1;
		}
		K %= 26;
		char c = string.charAt(i);
		if (K >= 'z' - c + 1) {
			System.out.print((char)('a' + (K - 'z' + c -1 ) % 26));
		} else {
			System.out.print( (char)(c + K));
		}
	} 
}

Submission

Task問題 C - 次のアルファベット / Next Letter
User nameユーザ名 kelvinlu
Created time投稿日時
Language言語 Java8 (OpenJDK 1.8.0)
Status状態 WA
Score得点 0
Source lengthソースコード長 664 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - 0_00.txt,0_01.txt,0_02.txt
All 0 / 400 0_00.txt,0_01.txt,0_02.txt,1_00.txt,1_01.txt,1_02.txt,1_03.txt,1_04.txt,1_05.txt,1_06.txt,1_07.txt,1_08.txt,1_09.txt,1_10.txt,1_11.txt,1_12.txt,1_13.txt,1_14.txt,1_15.txt,1_16.txt,1_17.txt,1_18.txt,1_19.txt,1_20.txt,1_21.txt,1_22.txt,1_23.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
0_00.txt AC 92 ms 19668 KB
0_01.txt AC 90 ms 18768 KB
0_02.txt AC 90 ms 21844 KB
1_00.txt AC 90 ms 19796 KB
1_01.txt AC 92 ms 21716 KB
1_02.txt AC 91 ms 21332 KB
1_03.txt AC 92 ms 17620 KB
1_04.txt AC 92 ms 18900 KB
1_05.txt AC 90 ms 18640 KB
1_06.txt AC 436 ms 35548 KB
1_07.txt AC 425 ms 35344 KB
1_08.txt WA
1_09.txt WA
1_10.txt WA
1_11.txt WA
1_12.txt WA
1_13.txt WA
1_14.txt WA
1_15.txt WA
1_16.txt AC 431 ms 33880 KB
1_17.txt AC 411 ms 31092 KB
1_18.txt AC 430 ms 31600 KB
1_19.txt AC 418 ms 35104 KB
1_20.txt AC 408 ms 35332 KB
1_21.txt AC 433 ms 33272 KB
1_22.txt AC 422 ms 32392 KB
1_23.txt AC 421 ms 31312 KB