제출 #20824

#제출 시각아이디문제언어결과실행 시간메모리
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; }

컴파일 시 표준 에러 (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...