Submission #159744

#TimeUsernameProblemLanguageResultExecution timeMemory
159744geon040702주유소 (KOI16_gasM)C++14
100 / 100
34 ms3332 KiB
#include <bits/stdc++.h>
using namespace std;

long long int dist[100010];
long long int gas[100010];
long long int res;
int city;

int main(void)
{
    int i;
    scanf("%d", &city);

    for(i=1;i<city;i++) {
        scanf("%lld", &dist[i]);
    }

    for(i=1;i<=city;i++) {
        scanf("%lld", &gas[i]);
        if(i != 1 && gas[i-1] < gas[i]) {
            gas[i] = gas[i-1];
        }
        if(i < city) {
            res += dist[i] * gas[i];
        }
    }

    printf("%lld\n", res);
    return 0;
}

Compilation message (stderr)

gas.cpp: In function 'int main()':
gas.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &city);
     ~~~~~^~~~~~~~~~~~~
gas.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld", &dist[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~
gas.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld", &gas[i]);
         ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...