結果
問題 | No.327 アルファベット列 |
ユーザー |
![]() |
提出日時 | 2021-01-29 11:15:20 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 839 bytes |
コンパイル時間 | 200 ms |
コンパイル使用メモリ | 29,952 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-26 22:52:30 |
合計ジャッジ時間 | 1,823 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 50 |
ソースコード
#include <stdio.h>#define u_LL unsigned long longint ori_pow(u_LL base, u_LL num, u_LL* ans){int isOver = 0;*ans = 1;u_LL i = num;while (num != 0) {if (*ans * base < *ans) {isOver = 1;break;}*ans = *ans * base;num--;}return isOver;}int main(int argc, char* argv[]){char ANS[1000] = "";u_LL targetNumber = 0;scanf("%lld", &targetNumber);u_LL max = 0;if (0 != ori_pow(10, 12, &max)) {return 0;}if (max < targetNumber) {return 0;}u_LL alphaCnt = 26;int suffix = 0;u_LL answer = targetNumber + 1;do {answer--;u_LL surplus = answer % alphaCnt;char alpha = 'A' + surplus;ANS[suffix] = alpha;suffix++;answer = answer / alphaCnt;} while (answer);for (int i = 0; i < suffix; i++) {printf("%c", ANS[suffix - (i + 1)]);}printf("\n");return 0;}