結果

問題 No.182 新規性の虜
ユーザー piyoko_212
提出日時 2015-12-28 22:19:42
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 301 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 36,812 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 20:01:22
合計ジャッジ時間 1,747 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         int a;scanf("%d",&a);
      |               ~~~~~^~~~~~~~~
main.cpp:7:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         for(int i=0;i<a;i++)scanf("%d",b+i);
      |                             ~~~~~^~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<algorithm>
using namespace std;
int b[110000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d",b+i);
	std::sort(b,b+a);
	int ret=0;
	for(int i=0;i<a;i++){
		if(i&&b[i-1]==b[i])continue;
		if(i<a-1&&b[i]==b[i+1])continue;
		ret++;
	}
	printf("%d\n",ret);
}
0