結果

問題 No.182 新規性の虜
ユーザー Bantako
提出日時 2017-06-27 20:20:11
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 459 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 22,912 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2024-09-27 13:49:56
合計ジャッジ時間 24,056 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 TLE * 1 -- * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d",&num[i]);
      |         ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int num[100000];
main(){
    int N;
    scanf("%d",&N);
    for(int i = 0;i < N;i++){
        scanf("%d",&num[i]);
    }
    int count = 0;
    for(int i = 0;i < N;i++){
        if(!num[i]){continue;}
       int target = num[i];
       int c = 0;
       for(int j = i+1;j < N;j++){
           if(num[j] == target){
               num[j] = 0;
               c++;
           }
       }
       if(!c){count++;}
    }
    printf("%d\n",count);
}
0