Submission #20824

#TimeUsernameProblemLanguageResultExecution timeMemory
20824model_code주유소 (KOI16_gasM)C++11
100 / 100
29 ms1896 KiB
#include<stdio.h>
int n;
int dist[100100];
int cost[100100];
long long int ans;
long long int mc;
int main() {
int i;
scanf("%d", &n);
for (i = 0; i < n - 1; i++) {
scanf("%d", &dist[i]);
}
for (i = 0; i < n; i++) {
scanf("%d", &cost[i]);
}
ans = 0;
mc = cost[0];
for (i = 0; i < n-1; i++) {
if (mc > cost[i])mc = cost[i];
ans += mc*dist[i];
}
printf("%lld", ans);
return 0;
}

Compilation message (stderr)

gas.cpp: In function 'int main()':
gas.cpp:9:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%d", &n);
                ^
gas.cpp:11:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%d", &dist[i]);
                      ^
gas.cpp:14:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%d", &cost[i]);
                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...