結果

問題 No.29 パワーアップ
ユーザー ciel
提出日時 2014-11-16 19:04:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 273 bytes
コンパイル時間 591 ms
コンパイル使用メモリ 45,056 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-31 20:54:48
合計ジャッジ時間 1,398 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         for(scanf("%d",&n);i<3*n;i++)scanf("%d",&x),se[x]++;
      |             ~~~~~^~~~~~~~~
main.cpp:6:43: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         for(scanf("%d",&n);i<3*n;i++)scanf("%d",&x),se[x]++;
      |                                      ~~~~~^~~~~~~~~

ソースコード

diff #

#include <map>
#include <cstdio>
int main(){
	std::map<int,int>se;
	int i=0,n,x,c=0,r=0;
	for(scanf("%d",&n);i<3*n;i++)scanf("%d",&x),se[x]++;
	for(std::map<int,int>::iterator it=se.begin();it!=se.end();++it)r+=it->second/2,c+=it->second%2;
	printf("%d\n",r+c/4);
}
0