답안 #84030

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
84030 2018-11-12T12:51:54 Z tjdgus4384 주유소 (KOI16_gasM) C++14
58 / 100
25 ms 2380 KB
#include<cstdio>
int d[100001], m[100001];

int main()
{
    int n, s = 1000000000;
    scanf("%d", &n);
    for(int i = 1;i < n;i++)
    {
        scanf("%d", &d[i]);
    }
    for(int i = 0;i < n;i++)
    {
        scanf("%d", &m[i]);
    }
    int ans = 0;
    for(int i = 0;i < n;i++)
    {
        if(m[i] < s) s = m[i];
        ans += s * d[i + 1];
    }
    printf("%d", ans);
    return 0;
}

Compilation message

gas.cpp: In function 'int main()':
gas.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
gas.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &d[i]);
         ~~~~~^~~~~~~~~~~~~
gas.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &m[i]);
         ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 1784 KB Output is correct
2 Correct 23 ms 2380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2380 KB Output is correct
2 Correct 2 ms 2380 KB Output is correct
3 Correct 2 ms 2380 KB Output is correct
4 Correct 2 ms 2380 KB Output is correct
5 Correct 2 ms 2380 KB Output is correct
6 Correct 2 ms 2380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 1784 KB Output is correct
2 Correct 23 ms 2380 KB Output is correct
3 Correct 3 ms 2380 KB Output is correct
4 Correct 2 ms 2380 KB Output is correct
5 Correct 2 ms 2380 KB Output is correct
6 Correct 2 ms 2380 KB Output is correct
7 Correct 2 ms 2380 KB Output is correct
8 Correct 2 ms 2380 KB Output is correct
9 Incorrect 2 ms 2380 KB Output isn't correct
10 Halted 0 ms 0 KB -