제출 #696993

#제출 시각아이디문제언어결과실행 시간메모리
696993allllekssssaMoney (IZhO17_money)C++14
0 / 100
1 ms212 KiB
#include<bits/stdc++.h>

using namespace std;

const int maxN = 1e6 + 10;
int a[maxN];
int n;
int cnt[maxN];
int main() {

	cin >> n;

	for (int i = 1; i<=n; i++) {
		scanf("%d", &a[i]);
		cnt[a[i]]++;
	}
    
    int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (i < n && a[i] > a[i + 1]) {
			++ans;
			continue;
		}
		if (i == n) continue;
		
		if (a[i] == a[i + 1]) continue;

		for (int j = i - 1; j > 0; j--) {
			if (a[j] >= a[i] && a[j] <= a[i + 1]) {
				++ans;
			}
		}
	}

	cout << ans + 1 << endl;
}

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

money.cpp: In function 'int main()':
money.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%d", &a[i]);
      |   ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...