結果

問題 No.3110 Like CPCTF?
ユーザー pengin_2000
提出日時 2025-04-18 20:35:46
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 440 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 26,112 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-18 20:36:02
合計ジャッジ時間 1,088 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%s", s);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	char s[32];
	scanf("%s", s);
	int i, j, k, l, m;
	int ans = 0;
	for (i = 0; i < n; i++)
		for (j = i + 1; j < n; j++)
			for (k = j + 1; k < n; k++)
				for (l = k + 1; l < n; l++)
					for (m = l + 1; m < n; m++)
						if (s[i] != s[j] && s[i] == s[k] && s[i] != s[l] && s[i] != s[m] && s[j] != s[l] && s[j] != s[m] && s[l] != s[m])
							ans++;
	printf("%d\n", ans);
	return 0;
}
0