답안 #895061

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
895061 2023-12-29T11:26:11 Z Litusiano Rabbit Carrot (LMIO19_triusis) C++17
컴파일 오류
0 ms 0 KB
#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;
}

Compilation message

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