結果

問題 No.182 新規性の虜
ユーザー くれちーくれちー
提出日時 2016-08-26 11:22:48
言語 C90
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 612 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 21,248 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 16:53:28
合計ジャッジ時間 2,985 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 0 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 0 ms
6,940 KB
testcase_04 AC 0 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 0 ms
6,944 KB
testcase_14 AC 1 ms
6,944 KB
testcase_15 AC 0 ms
6,944 KB
testcase_16 AC 0 ms
6,944 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 0 ms
6,944 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 0 ms
6,940 KB
evil01.txt RE -
evil02.txt RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:20:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:22:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |                 scanf("%d", &a[i]);
      |                 ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

void sort(int arg[], int n) {
	int temp, i, j;

	for (i = 0; i < n - 1; i++) {
		for (j = n - 1; j > i; j--) {
			if (arg[j] < arg[j - 1]) {
				temp = arg[j];
				arg[j] = arg[j - 1];
				arg[j - 1] = temp;
			}
		}
	}
}

int main() {
	int n, a[10000], cnt = 1, flag = 0, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	
	sort(a, n);
	for (i = 1; i < n; i++) {
		if (flag == 0) {
			if (a[i] != a[i - 1]) cnt++;
			else {
				cnt--;
				flag = 1;
			}
		}
		else {
			if (a[i] != a[i - 1]) {
				cnt++;
				flag = 0;
			}
		}
	}

	printf("%d\n", cnt);
	return 0;
}
0