結果

問題 No.3132 暗号メッセージ
ユーザー pengin_2000
提出日時 2025-05-02 22:08:30
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 364 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 25,344 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-05-02 22:08:34
合計ジャッジ時間 1,155 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:9:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |                 scanf("%d", &d[i]);
      |                 ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int d[102];
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	for (i = 0; i < n; i++)
		scanf("%d", &d[i]);
	for (i = 0; i < n - 1; i++)
	{
		if (d[i] > d[i + 1])
		{
			d[i] ^= d[i + 1];
			d[i + 1] ^= d[i];
			d[i] ^= d[i + 1];
			if (i > 0)
				i -= 2;
		}
	}
	for (i = 0; i < n; i++)
		printf("%c", 'A' + d[i] % 26);
	printf("\n");
	return 0;
}
0