제출 #1364192

#제출 시각아이디문제언어결과실행 시간메모리
1364192kmath628버블 정렬 (OJUZ10_bubblesort)C++20
34 / 100
1095 ms816 KiB
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k,i;
    scanf("%d %d",&n,&k);
    vector<int> a(n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    while(k--){
        for(i=0;i<n-1;i++)
            if(a[i]>a[i+1]) swap(a[i],a[i+1]);
    }
    for(i=0;i<n;i++) printf("%d ",a[i]);
    printf("\n");
    return 0;
}

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

bubblesort.cpp: In function 'int main()':
bubblesort.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |     scanf("%d %d",&n,&k);
      |     ~~~~~^~~~~~~~~~~~~~~
bubblesort.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |         scanf("%d",&a[i]);
      |         ~~~~~^~~~~~~~~~~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…