제출 #91300

#제출 시각아이디문제언어결과실행 시간메모리
91300Aydarov03K개의 묶음 (IZhO14_blocks)C++14
0 / 100
3 ms608 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[100005];
int ans;

main()
{
    int n , k;
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
        scanf("%d" , &a[i]);

    sort( a + 1 , a + 1 + n );

    ans = a[n];

    for(int i = 1; i < k; i++)
        ans += a[i];

    cout << ans;
}

컴파일 시 표준 에러 (stderr) 메시지

blocks.cpp:7:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
blocks.cpp: In function 'int main()':
blocks.cpp:12:27: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
         scanf("%d" , &a[i]);
                      ~~~~~^
blocks.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d" , &a[i]);
         ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...