結果

問題 No.327 アルファベット列
ユーザー jp_stejp_ste
提出日時 2016-02-01 07:41:56
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 810 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 75,776 KB
実行使用メモリ 57,880 KB
最終ジャッジ日時 2023-10-21 18:27:30
合計ジャッジ時間 10,626 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
57,404 KB
testcase_01 AC 131 ms
57,500 KB
testcase_02 AC 132 ms
57,604 KB
testcase_03 AC 132 ms
57,344 KB
testcase_04 AC 132 ms
57,776 KB
testcase_05 AC 132 ms
57,388 KB
testcase_06 AC 132 ms
57,596 KB
testcase_07 AC 133 ms
57,344 KB
testcase_08 AC 134 ms
57,548 KB
testcase_09 AC 132 ms
57,484 KB
testcase_10 AC 132 ms
57,356 KB
testcase_11 AC 133 ms
57,352 KB
testcase_12 AC 132 ms
55,444 KB
testcase_13 AC 134 ms
57,376 KB
testcase_14 AC 134 ms
57,452 KB
testcase_15 AC 133 ms
57,400 KB
testcase_16 AC 136 ms
57,276 KB
testcase_17 AC 136 ms
57,232 KB
testcase_18 AC 133 ms
57,416 KB
testcase_19 AC 133 ms
57,424 KB
testcase_20 AC 135 ms
57,444 KB
testcase_21 AC 133 ms
57,420 KB
testcase_22 AC 134 ms
57,412 KB
testcase_23 AC 137 ms
57,452 KB
testcase_24 AC 130 ms
57,376 KB
testcase_25 AC 134 ms
57,376 KB
testcase_26 AC 131 ms
57,360 KB
testcase_27 AC 132 ms
57,612 KB
testcase_28 AC 133 ms
57,612 KB
testcase_29 AC 131 ms
57,524 KB
testcase_30 AC 130 ms
57,420 KB
testcase_31 AC 131 ms
57,384 KB
testcase_32 AC 131 ms
57,436 KB
testcase_33 AC 131 ms
57,416 KB
testcase_34 AC 133 ms
57,220 KB
testcase_35 AC 134 ms
57,408 KB
testcase_36 AC 133 ms
57,444 KB
testcase_37 AC 132 ms
57,348 KB
testcase_38 WA -
testcase_39 AC 131 ms
57,576 KB
testcase_40 AC 131 ms
57,528 KB
testcase_41 AC 136 ms
57,384 KB
testcase_42 AC 137 ms
57,388 KB
testcase_43 AC 132 ms
57,576 KB
testcase_44 AC 133 ms
57,308 KB
testcase_45 AC 134 ms
57,344 KB
testcase_46 AC 133 ms
57,344 KB
testcase_47 AC 133 ms
57,380 KB
testcase_48 AC 135 ms
57,280 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 134 ms
57,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.Stack;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long N = scan.nextLong();
		
		if(N < 26) {
			System.out.println((char)(N+'A'));
		} else {
			Stack<Long> stack = new Stack();
			long value = N;
			while(true) {
				long tmp1 = value / 26;
				long tmp2 = value % 26;
				stack.push(tmp2);
				if(tmp1 <= 26) {
					stack.push(tmp1);
					break;
				}
				value = tmp1;
			}
			
			while(!stack.empty()) {
				Long v = stack.pop();
				int n = stack.size();
					
				if(n>=2){
					if(stack.peek() == 0) {
						v--; 
					}
				}
				
				if(n>=1) {
					if(v == 0) {
						v=25L;
					} else { 
						v--; 
					}
				}

				System.out.print((char)(v + 'A'));
			}
			System.out.println();
		}
	}
}
0