結果

問題 No.3009 異なる数字の最大の範囲(勉強会用)
ユーザー issekiampissekiamp
提出日時 2015-02-28 17:36:44
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 564 bytes
コンパイル時間 2,013 ms
コンパイル使用メモリ 23,572 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-03 16:49:47
合計ジャッジ時間 3,555 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 0 ms
4,380 KB
testcase_08 AC 0 ms
4,380 KB
testcase_09 AC 1 ms
4,384 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 WA -
testcase_14 AC 1 ms
4,384 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:16:13: warning: implicit declaration of function ‘calloc’ [-Wimplicit-function-declaration]
  b = (int *)calloc(a, sizeof(int));
             ^~~~~~
main.c:16:13: warning: incompatible implicit declaration of built-in function ‘calloc’
main.c:16:13: note: include ‘<stdlib.h>’ or provide a declaration of ‘calloc’
main.c:3:1:
+#include <stdlib.h>
 
main.c:16:13:
  b = (int *)calloc(a, sizeof(int));
             ^~~~~~

ソースコード

diff #

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

int main(void) {
	// your code goes here
	int a;
	int *b;
	char data[100000];
	char *point;
	int count = 0;
	int i,j;
	
	scanf("%d\r\n", &a);
	fgets(data, sizeof(data), stdin);

	b = (int *)calloc(a, sizeof(int));
	point = strtok(data, " ");

	for (i=0; i<a; i++)
	{
		sscanf(point, "%d", b+i);

		for (j=0; j<i; j++)
		{
			if (*(b+i) == *(b+j))
			{
				break;
			}
		}
		
		if (j == i)
		{
			count++;
		}
		
		point = strtok(NULL, " ");
		if (point == NULL)
		{
			break;
		}
	}
	
	printf("%d\r", count);
	
	return 0;
}
0