답안 #159728

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

using namespace std;

int main () {
int x,n,p,a,b,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:6:13: warning: unused variable 'b' [-Wunused-variable]
 int x,n,p,a,b,y;
             ^
tarifa.cpp:19:11: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
 cout << a+y;
           ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 6 ms 256 KB Output isn't correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Incorrect 2 ms 256 KB Output isn't correct
6 Incorrect 2 ms 256 KB Output isn't correct
7 Incorrect 2 ms 256 KB Output isn't correct
8 Incorrect 2 ms 256 KB Output isn't correct
9 Incorrect 2 ms 256 KB Output isn't correct
10 Incorrect 2 ms 256 KB Output isn't correct