답안 #167372

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
167372 2019-12-07T18:22:21 Z 44442 Akcija (COCI15_akcija) C++11
80 / 80
75 ms 5624 KB
#include <bits/stdc++.h>
using namespace std;
int n;
long long a,s;
multiset<int>m;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
scanf("%d",&n);
for(int i=0;i<n;i++){
	 scanf("\n%lld",&a);
	 m.insert(a);
	 s=s+a;
}
 m.insert(0);
 m.insert(0);
 m.insert(0);
 multiset<int>::iterator it;
 it=m.end();
 it--;
 it--;
 it--;
 while(*it>0){
 	 s=s-*it;
 	 it--;
 	 it--;
 	 it--;
 }
 printf("%lld",s);
return 0;
}

Compilation message

akcija.cpp: In function 'int main()':
akcija.cpp:9:6: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%d",&n);
 ~~~~~^~~~~~~~~
akcija.cpp:11:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("\n%lld",&a);
   ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 75 ms 5496 KB Output is correct
7 Correct 46 ms 5368 KB Output is correct
8 Correct 45 ms 5496 KB Output is correct
9 Correct 74 ms 5624 KB Output is correct
10 Correct 69 ms 5624 KB Output is correct