結果

問題 No.18 うーさー暗号
ユーザー kdaiki211kdaiki211
提出日時 2017-01-09 00:05:06
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 326 bytes
コンパイル時間 1,184 ms
コンパイル使用メモリ 20,864 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-17 23:11:25
合計ジャッジ時間 1,667 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%s", S);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdint.h>
#include <stdio.h>
#include <string.h>

#define GETA ('Z' - 'A' + 1)

int main(void)
{
	char S[1024+1];
	int len;
	scanf("%s", S);
	len = strlen(S);
	for (int i = 0; i < len; i++) {
		int ofst = S[i] - 'A' - (i + 1);
		while (ofst < 0) ofst += GETA;
		putchar('A' + ofst);
	}
	putchar('\n');
	return 0;
}

0