답안 #159557

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
159557 2019-10-23T08:27:44 Z geon040702 지능형 기차 2 (KOI11_train2) C++14
16 / 16
2 ms 504 KB
#include <bits/stdc++.h>
using namespace std;

pair<int, int> Data[15];
int people, ans_max;

int main(void)
{
    int i;

    for(i=1;i<=10;i++) {
        scanf("%d %d", &Data[i].first, &Data[i].second);
        people -= Data[i].first;
        people += Data[i].second;
        ans_max = max(ans_max, people);
    }

    printf("%d\n", ans_max);
    return 0;
}

Compilation message

train.cpp: In function 'int main()':
train.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &Data[i].first, &Data[i].second);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 252 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct