답안 #171328

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
171328 2019-12-28T11:02:10 Z itiam Pismo (COCI18_pismo) C++11
70 / 70
72 ms 1280 KB
#include <iostream>

using namespace std;

int main(){
    int N,njm,prix,x,v,m,raz;
    cin >> N;
    cin >> prix;
    for (int i=0;i<N-1;i++){
        cin >> x;
        if (x>prix){
            raz=x-prix;}
        else{
            raz=prix-x;}
        if (i==0){
            njm=raz;
        }
        else{
            if (njm>raz)    njm=raz;
        }
        prix=x;
    }
    cout << njm;
    return 0;
}

Compilation message

pismo.cpp: In function 'int main()':
pismo.cpp:6:22: warning: unused variable 'v' [-Wunused-variable]
     int N,njm,prix,x,v,m,raz;
                      ^
pismo.cpp:6:24: warning: unused variable 'm' [-Wunused-variable]
     int N,njm,prix,x,v,m,raz;
                        ^
pismo.cpp:23:10: warning: 'njm' may be used uninitialized in this function [-Wmaybe-uninitialized]
     cout << njm;
     ~~~~~^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 4 ms 380 KB Output is correct
5 Correct 58 ms 1280 KB Output is correct
6 Correct 72 ms 1232 KB Output is correct
7 Correct 69 ms 1252 KB Output is correct