Submission #84030

#TimeUsernameProblemLanguageResultExecution timeMemory
84030tjdgus4384주유소 (KOI16_gasM)C++14
58 / 100
25 ms2380 KiB
#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 (stderr)

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]);
         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...