답안 #159729

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
159729 2019-10-24T08:25:09 Z Doda Tarifa (COCI16_tarifa) C++14
0 / 50
2 ms 380 KB
#include <iostream>

using namespace std;

int main () {
int x,n,p,a,y;
cin >> y >> n ;
x = y;
for (int i = 0; i<n ; i++){
	cin >> p;
	x = y; 
	x+= a;
	a = 0;
	if (p<x){
		a += x-p ;
	}
}

cout << a+y;

return 0;
}

Compilation message

tarifa.cpp: In function 'int main()':
tarifa.cpp:19:11: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
 cout << a+y;
           ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Incorrect 2 ms 380 KB Output isn't correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Incorrect 2 ms 376 KB Output isn't correct
10 Incorrect 2 ms 376 KB Output isn't correct