結果

問題 No.18 うーさー暗号
ユーザー kachipankachipan
提出日時 2023-06-23 13:43:48
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 428 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 29,312 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 18:34:40
合計ジャッジ時間 701 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

int main()
{
	enum ALPHABET
	{
		Alphabet=26,
	};

	int cnt = 0;
	int size = 'A';
	char str[1025] = "";
	scanf("%s", str);
	for (int i = 0;str[i] != '\0';i++)
	{
		cnt++;
		int minus = 0;
		if (cnt > Alphabet)
		{
			cnt -= Alphabet;
		}
		
		minus = cnt;
		str[i] -= minus;

		if (str[i] < size)
		{
			str[i] += Alphabet;
		}
	}

	printf("%s", str);

	return 0;
}

0