Submission #924308

#TimeUsernameProblemLanguageResultExecution timeMemory
924308rainboy주유소 (KOI16_gasM)C11
100 / 100
17 ms2228 KiB
#include <stdio.h>

#define N	100000
#define INF	0x3f3f3f3f

int min(int a, int b) { return a < b ? a : b; }

int main() {
	static int dd[N];
	int n, i, c, c_;
	long long ans;

	scanf("%d", &n);
	for (i = 0; i + 1 < n; i++)
		scanf("%d", &dd[i]);
	c_ = INF, ans = 0;
	for (i = 0; i + 1 < n; i++) {
		scanf("%d", &c);
		c_ = min(c_, c);
		ans += (long long) c_ * dd[i];
	}
	printf("%lld\n", ans);
	return 0;
}

Compilation message (stderr)

gas.c: In function 'main':
gas.c:13:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
gas.c:15:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d", &dd[i]);
      |   ^~~~~~~~~~~~~~~~~~~
gas.c:18:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   scanf("%d", &c);
      |   ^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...