제출 #895061

#제출 시각아이디문제언어결과실행 시간메모리
895061LitusianoRabbit Carrot (LMIO19_triusis)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;

#define int long long

signed main(){
	int n,h; cin>>n>>h; n++
	int ans = 0;
	vector<int> v(n+1,0); //for(int& i : v) cin>>i
	for(int i = 1; i<=n; i++){
		cin>>v[i];
		if(v[i] > i*h){
			ans++;
			v[i] = v[i-1] + h;
		}
	}
	cout<<ans<<endl;
}

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

triusis.cpp: In function 'int main()':
triusis.cpp:7:25: error: expected ';' before 'long'
    7 |  int n,h; cin>>n>>h; n++
      |                         ^
      |                         ;
triusis.cpp:13:4: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |    ans++;
      |    ^~~
      |    abs
triusis.cpp:17:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |  cout<<ans<<endl;
      |        ^~~
      |        abs